fix #1746 - SQL Server installation needs to allow configuration of encryption setting on .NET 6

This commit is contained in:
Shaun Walker 2021-11-03 16:37:37 -04:00
parent d2d52a7eb3
commit bd5a827593
2 changed files with 19 additions and 8 deletions

View File

@ -1,6 +1,7 @@
@namespace Oqtane.Installer.Controls @namespace Oqtane.Installer.Controls
@implements Oqtane.Interfaces.IDatabaseConfigControl @implements Oqtane.Interfaces.IDatabaseConfigControl
@inject IStringLocalizer<SqlServerConfig> Localizer @inject IStringLocalizer<SqlServerConfig> Localizer
@inject IStringLocalizer<SharedResources> SharedLocalizer
<div class="row mb-1 align-items-center"> <div class="row mb-1 align-items-center">
<Label Class="col-sm-3" For="server" HelpText="Enter the database server" ResourceKey="Server">Server:</Label> <Label Class="col-sm-3" For="server" HelpText="Enter the database server" ResourceKey="Server">Server:</Label>
@ -38,6 +39,15 @@
</div> </div>
</div> </div>
} }
<div class="row mb-1 align-items-center">
<Label Class="col-sm-3" For="encryption" HelpText="Specify if you are using an encrypted database connection. It is highly recommended to use encryption in a production environment." ResourceKey="Encryption">Encryption:</Label>
<div class="col-sm-9">
<select id="encryption" class="form-select custom-select" @bind="@_encryption">
<option value="true">@SharedLocalizer["True"]</option>
<option value="false">@SharedLocalizer["False"]</option>
</select>
</div>
</div>
@code { @code {
private string _server = String.Empty; private string _server = String.Empty;
@ -45,6 +55,7 @@
private string _security = "integrated"; private string _security = "integrated";
private string _uid = String.Empty; private string _uid = String.Empty;
private string _pwd = String.Empty; private string _pwd = String.Empty;
private string _encryption = "false";
public string GetConnectionString() public string GetConnectionString()
{ {
@ -60,16 +71,10 @@
connectionString += "Integrated Security=SSPI;"; connectionString += "Integrated Security=SSPI;";
} }
else else
{
if (!String.IsNullOrEmpty(_uid) && !String.IsNullOrEmpty(_pwd))
{ {
connectionString += $"User ID={_uid};Password={_pwd};"; connectionString += $"User ID={_uid};Password={_pwd};";
} }
else connectionString += $"Encrypt={_encryption};";
{
connectionString = String.Empty;
}
}
return connectionString; return connectionString;
} }

View File

@ -153,4 +153,10 @@
<data name="Integrated" xml:space="preserve"> <data name="Integrated" xml:space="preserve">
<value>Integrated</value> <value>Integrated</value>
</data> </data>
<data name="Encryption,Text" xml:space="preserve">
<value>Encryption:</value>
</data>
<data name="Encryption.HelpText" xml:space="preserve">
<value>Specify if you are using an encrypted database connection. It is highly recommended to use encryption in a production environment.</value>
</data>
</root> </root>