moved default credential selection to the new credentials option page and created a cred records combobox

This commit is contained in:
David Sparer
2017-04-14 18:01:43 -06:00
parent b389b20ca3
commit 5c785ca1c6
7 changed files with 274 additions and 203 deletions

View File

@@ -0,0 +1,36 @@
namespace mRemoteNG.UI.Controls
{
partial class CredentialRecordComboBox
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
}
#endregion
}
}

View File

@@ -0,0 +1,26 @@
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using mRemoteNG.Credential;
namespace mRemoteNG.UI.Controls
{
public partial class CredentialRecordComboBox : ComboBox
{
public IEnumerable<ICredentialRecord> CredentialRecords { get; set; }
public CredentialRecordComboBox()
{
InitializeComponent();
PopulateItems(CredentialRecords);
}
private void PopulateItems(IEnumerable<ICredentialRecord> credentialRecords)
{
if (credentialRecords == null) return;
Items.Clear();
foreach (var credential in credentialRecords)
Items.Add(credential);
}
}
}

View File

@@ -38,17 +38,6 @@ namespace mRemoteNG.UI.Forms.OptionsPages
this.numRdpReconnectionCount = new System.Windows.Forms.NumericUpDown();
this.chkSingleClickOnConnectionOpensIt = new System.Windows.Forms.CheckBox();
this.chkHostnameLikeDisplayName = new System.Windows.Forms.CheckBox();
this.pnlDefaultCredentials = new System.Windows.Forms.Panel();
this.radCredentialsCustom = new System.Windows.Forms.RadioButton();
this.lblDefaultCredentials = new System.Windows.Forms.Label();
this.radCredentialsNoInfo = new System.Windows.Forms.RadioButton();
this.radCredentialsWindows = new System.Windows.Forms.RadioButton();
this.txtCredentialsDomain = new System.Windows.Forms.TextBox();
this.lblCredentialsUsername = new System.Windows.Forms.Label();
this.txtCredentialsPassword = new System.Windows.Forms.TextBox();
this.lblCredentialsPassword = new System.Windows.Forms.Label();
this.txtCredentialsUsername = new System.Windows.Forms.TextBox();
this.lblCredentialsDomain = new System.Windows.Forms.Label();
this.chkSingleClickOnOpenedConnectionSwitchesToIt = new System.Windows.Forms.CheckBox();
this.pnlAutoSave = new System.Windows.Forms.Panel();
this.lblAutoSave1 = new System.Windows.Forms.Label();
@@ -63,7 +52,6 @@ namespace mRemoteNG.UI.Forms.OptionsPages
this.pnlRdpReconnectionCount.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numRDPConTimeout)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numRdpReconnectionCount)).BeginInit();
this.pnlDefaultCredentials.SuspendLayout();
this.pnlAutoSave.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numAutoSave)).BeginInit();
this.pnlConfirmCloseConnection.SuspendLayout();
@@ -159,123 +147,6 @@ namespace mRemoteNG.UI.Forms.OptionsPages
this.chkHostnameLikeDisplayName.Text = "Set hostname like display name when creating new connections";
this.chkHostnameLikeDisplayName.UseVisualStyleBackColor = true;
//
// pnlDefaultCredentials
//
this.pnlDefaultCredentials.Controls.Add(this.radCredentialsCustom);
this.pnlDefaultCredentials.Controls.Add(this.lblDefaultCredentials);
this.pnlDefaultCredentials.Controls.Add(this.radCredentialsNoInfo);
this.pnlDefaultCredentials.Controls.Add(this.radCredentialsWindows);
this.pnlDefaultCredentials.Controls.Add(this.txtCredentialsDomain);
this.pnlDefaultCredentials.Controls.Add(this.lblCredentialsUsername);
this.pnlDefaultCredentials.Controls.Add(this.txtCredentialsPassword);
this.pnlDefaultCredentials.Controls.Add(this.lblCredentialsPassword);
this.pnlDefaultCredentials.Controls.Add(this.txtCredentialsUsername);
this.pnlDefaultCredentials.Controls.Add(this.lblCredentialsDomain);
this.pnlDefaultCredentials.Location = new System.Drawing.Point(3, 139);
this.pnlDefaultCredentials.Name = "pnlDefaultCredentials";
this.pnlDefaultCredentials.Size = new System.Drawing.Size(596, 175);
this.pnlDefaultCredentials.TabIndex = 12;
//
// radCredentialsCustom
//
this.radCredentialsCustom.AutoSize = true;
this.radCredentialsCustom.Location = new System.Drawing.Point(16, 69);
this.radCredentialsCustom.Name = "radCredentialsCustom";
this.radCredentialsCustom.Size = new System.Drawing.Size(87, 17);
this.radCredentialsCustom.TabIndex = 3;
this.radCredentialsCustom.Text = "the following:";
this.radCredentialsCustom.UseVisualStyleBackColor = true;
this.radCredentialsCustom.CheckedChanged += new System.EventHandler(this.radCredentialsCustom_CheckedChanged);
//
// lblDefaultCredentials
//
this.lblDefaultCredentials.AutoSize = true;
this.lblDefaultCredentials.Location = new System.Drawing.Point(3, 9);
this.lblDefaultCredentials.Name = "lblDefaultCredentials";
this.lblDefaultCredentials.Size = new System.Drawing.Size(257, 13);
this.lblDefaultCredentials.TabIndex = 0;
this.lblDefaultCredentials.Text = "For empty Username, Password or Domain fields use:";
//
// radCredentialsNoInfo
//
this.radCredentialsNoInfo.AutoSize = true;
this.radCredentialsNoInfo.Checked = true;
this.radCredentialsNoInfo.Location = new System.Drawing.Point(16, 31);
this.radCredentialsNoInfo.Name = "radCredentialsNoInfo";
this.radCredentialsNoInfo.Size = new System.Drawing.Size(91, 17);
this.radCredentialsNoInfo.TabIndex = 1;
this.radCredentialsNoInfo.TabStop = true;
this.radCredentialsNoInfo.Text = "no information";
this.radCredentialsNoInfo.UseVisualStyleBackColor = true;
//
// radCredentialsWindows
//
this.radCredentialsWindows.AutoSize = true;
this.radCredentialsWindows.Location = new System.Drawing.Point(16, 50);
this.radCredentialsWindows.Name = "radCredentialsWindows";
this.radCredentialsWindows.Size = new System.Drawing.Size(227, 17);
this.radCredentialsWindows.TabIndex = 2;
this.radCredentialsWindows.Text = "my current credentials (windows logon info)";
this.radCredentialsWindows.UseVisualStyleBackColor = true;
//
// txtCredentialsDomain
//
this.txtCredentialsDomain.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtCredentialsDomain.Enabled = false;
this.txtCredentialsDomain.Location = new System.Drawing.Point(140, 147);
this.txtCredentialsDomain.Name = "txtCredentialsDomain";
this.txtCredentialsDomain.Size = new System.Drawing.Size(150, 20);
this.txtCredentialsDomain.TabIndex = 9;
//
// lblCredentialsUsername
//
this.lblCredentialsUsername.Enabled = false;
this.lblCredentialsUsername.Location = new System.Drawing.Point(37, 95);
this.lblCredentialsUsername.Name = "lblCredentialsUsername";
this.lblCredentialsUsername.Size = new System.Drawing.Size(97, 13);
this.lblCredentialsUsername.TabIndex = 4;
this.lblCredentialsUsername.Text = "Username:";
this.lblCredentialsUsername.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// txtCredentialsPassword
//
this.txtCredentialsPassword.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtCredentialsPassword.Enabled = false;
this.txtCredentialsPassword.Location = new System.Drawing.Point(140, 120);
this.txtCredentialsPassword.Name = "txtCredentialsPassword";
this.txtCredentialsPassword.Size = new System.Drawing.Size(150, 20);
this.txtCredentialsPassword.TabIndex = 7;
this.txtCredentialsPassword.UseSystemPasswordChar = true;
//
// lblCredentialsPassword
//
this.lblCredentialsPassword.Enabled = false;
this.lblCredentialsPassword.Location = new System.Drawing.Point(34, 123);
this.lblCredentialsPassword.Name = "lblCredentialsPassword";
this.lblCredentialsPassword.Size = new System.Drawing.Size(100, 13);
this.lblCredentialsPassword.TabIndex = 6;
this.lblCredentialsPassword.Text = "Password:";
this.lblCredentialsPassword.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// txtCredentialsUsername
//
this.txtCredentialsUsername.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtCredentialsUsername.Enabled = false;
this.txtCredentialsUsername.Location = new System.Drawing.Point(140, 93);
this.txtCredentialsUsername.Name = "txtCredentialsUsername";
this.txtCredentialsUsername.Size = new System.Drawing.Size(150, 20);
this.txtCredentialsUsername.TabIndex = 5;
//
// lblCredentialsDomain
//
this.lblCredentialsDomain.Enabled = false;
this.lblCredentialsDomain.Location = new System.Drawing.Point(34, 150);
this.lblCredentialsDomain.Name = "lblCredentialsDomain";
this.lblCredentialsDomain.Size = new System.Drawing.Size(100, 13);
this.lblCredentialsDomain.TabIndex = 8;
this.lblCredentialsDomain.Text = "Domain:";
this.lblCredentialsDomain.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// chkSingleClickOnOpenedConnectionSwitchesToIt
//
this.chkSingleClickOnOpenedConnectionSwitchesToIt.AutoSize = true;
@@ -334,7 +205,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages
this.pnlConfirmCloseConnection.Controls.Add(this.radCloseWarnMultiple);
this.pnlConfirmCloseConnection.Controls.Add(this.radCloseWarnExit);
this.pnlConfirmCloseConnection.Controls.Add(this.radCloseWarnNever);
this.pnlConfirmCloseConnection.Location = new System.Drawing.Point(3, 320);
this.pnlConfirmCloseConnection.Location = new System.Drawing.Point(3, 139);
this.pnlConfirmCloseConnection.Name = "pnlConfirmCloseConnection";
this.pnlConfirmCloseConnection.Size = new System.Drawing.Size(596, 137);
this.pnlConfirmCloseConnection.TabIndex = 13;
@@ -399,7 +270,6 @@ namespace mRemoteNG.UI.Forms.OptionsPages
this.Controls.Add(this.pnlRdpReconnectionCount);
this.Controls.Add(this.chkSingleClickOnConnectionOpensIt);
this.Controls.Add(this.chkHostnameLikeDisplayName);
this.Controls.Add(this.pnlDefaultCredentials);
this.Controls.Add(this.chkSingleClickOnOpenedConnectionSwitchesToIt);
this.Controls.Add(this.pnlAutoSave);
this.Controls.Add(this.pnlConfirmCloseConnection);
@@ -409,8 +279,6 @@ namespace mRemoteNG.UI.Forms.OptionsPages
this.pnlRdpReconnectionCount.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.numRDPConTimeout)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numRdpReconnectionCount)).EndInit();
this.pnlDefaultCredentials.ResumeLayout(false);
this.pnlDefaultCredentials.PerformLayout();
this.pnlAutoSave.ResumeLayout(false);
this.pnlAutoSave.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numAutoSave)).EndInit();
@@ -424,17 +292,6 @@ namespace mRemoteNG.UI.Forms.OptionsPages
internal System.Windows.Forms.Label lblRdpReconnectionCount;
internal System.Windows.Forms.CheckBox chkSingleClickOnConnectionOpensIt;
internal System.Windows.Forms.CheckBox chkHostnameLikeDisplayName;
internal System.Windows.Forms.Panel pnlDefaultCredentials;
internal System.Windows.Forms.RadioButton radCredentialsCustom;
internal System.Windows.Forms.Label lblDefaultCredentials;
internal System.Windows.Forms.RadioButton radCredentialsNoInfo;
internal System.Windows.Forms.RadioButton radCredentialsWindows;
internal System.Windows.Forms.TextBox txtCredentialsDomain;
internal System.Windows.Forms.Label lblCredentialsUsername;
internal System.Windows.Forms.TextBox txtCredentialsPassword;
internal System.Windows.Forms.Label lblCredentialsPassword;
internal System.Windows.Forms.TextBox txtCredentialsUsername;
internal System.Windows.Forms.Label lblCredentialsDomain;
internal System.Windows.Forms.CheckBox chkSingleClickOnOpenedConnectionSwitchesToIt;
internal System.Windows.Forms.Panel pnlAutoSave;
internal System.Windows.Forms.Label lblAutoSave1;

View File

@@ -1,7 +1,5 @@
using System;
using mRemoteNG.App;
using mRemoteNG.Config;
using mRemoteNG.Security.SymmetricEncryption;
namespace mRemoteNG.UI.Forms.OptionsPages
{
@@ -33,14 +31,6 @@ namespace mRemoteNG.UI.Forms.OptionsPages
lblAutoSave1.Text = Language.strAutoSaveEvery;
lblAutoSave2.Text = Language.strAutoSaveMins;
lblDefaultCredentials.Text = Language.strEmptyUsernamePasswordDomainFields;
radCredentialsNoInfo.Text = Language.strNoInformation;
radCredentialsWindows.Text = Language.strMyCurrentWindowsCreds;
radCredentialsCustom.Text = Language.strTheFollowing;
lblCredentialsUsername.Text = Language.strLabelUsername;
lblCredentialsPassword.Text = Language.strLabelPassword;
lblCredentialsDomain.Text = Language.strLabelDomain;
lblClosingConnections.Text = Language.strLabelClosingConnections;
radCloseWarnAll.Text = Language.strRadioCloseWarnAll;
radCloseWarnMultiple.Text = Language.strRadioCloseWarnMultiple;
@@ -62,26 +52,6 @@ namespace mRemoteNG.UI.Forms.OptionsPages
numAutoSave.Value = Convert.ToDecimal(Settings.Default.AutoSaveEveryMinutes);
// ReSharper disable once StringLiteralTypo
// ReSharper disable once SwitchStatementMissingSomeCases
switch (Settings.Default.EmptyCredentials)
{
case "noinfo":
radCredentialsNoInfo.Checked = true;
break;
case "windows":
radCredentialsWindows.Checked = true;
break;
case "custom":
radCredentialsCustom.Checked = true;
break;
}
txtCredentialsUsername.Text = Settings.Default.DefaultUsername;
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
txtCredentialsPassword.Text = cryptographyProvider.Decrypt(Settings.Default.DefaultPassword, Runtime.EncryptionKey);
txtCredentialsDomain.Text = Settings.Default.DefaultDomain;
switch (Settings.Default.ConfirmCloseConnection)
{
case (int) ConfirmCloseEnum.Never:
@@ -120,25 +90,6 @@ namespace mRemoteNG.UI.Forms.OptionsPages
FrmMain.Default.tmrAutoSave.Enabled = false;
}
if (radCredentialsNoInfo.Checked)
{
// ReSharper disable once StringLiteralTypo
Settings.Default.EmptyCredentials = "noinfo";
}
else if (radCredentialsWindows.Checked)
{
Settings.Default.EmptyCredentials = "windows";
}
else if (radCredentialsCustom.Checked)
{
Settings.Default.EmptyCredentials = "custom";
}
Settings.Default.DefaultUsername = txtCredentialsUsername.Text;
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
Settings.Default.DefaultPassword = cryptographyProvider.Encrypt(txtCredentialsPassword.Text, Runtime.EncryptionKey);
Settings.Default.DefaultDomain = txtCredentialsDomain.Text;
if (radCloseWarnAll.Checked)
{
Settings.Default.ConfirmCloseConnection = (int) ConfirmCloseEnum.All;
@@ -159,14 +110,6 @@ namespace mRemoteNG.UI.Forms.OptionsPages
Settings.Default.Save();
}
private void radCredentialsCustom_CheckedChanged(object sender, EventArgs e)
{
lblCredentialsUsername.Enabled = radCredentialsCustom.Checked;
lblCredentialsPassword.Enabled = radCredentialsCustom.Checked;
lblCredentialsDomain.Enabled = radCredentialsCustom.Checked;
txtCredentialsUsername.Enabled = radCredentialsCustom.Checked;
txtCredentialsPassword.Enabled = radCredentialsCustom.Checked;
txtCredentialsDomain.Enabled = radCredentialsCustom.Checked;
}
}
}

View File

@@ -30,6 +30,18 @@
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CredentialsPage));
this.checkBoxUnlockOnStartup = new System.Windows.Forms.CheckBox();
this.pnlDefaultCredentials = new System.Windows.Forms.Panel();
this.radCredentialsCustom = new System.Windows.Forms.RadioButton();
this.lblDefaultCredentials = new System.Windows.Forms.Label();
this.radCredentialsNoInfo = new System.Windows.Forms.RadioButton();
this.radCredentialsWindows = new System.Windows.Forms.RadioButton();
this.txtCredentialsDomain = new System.Windows.Forms.TextBox();
this.lblCredentialsUsername = new System.Windows.Forms.Label();
this.txtCredentialsPassword = new System.Windows.Forms.TextBox();
this.lblCredentialsPassword = new System.Windows.Forms.Label();
this.txtCredentialsUsername = new System.Windows.Forms.TextBox();
this.lblCredentialsDomain = new System.Windows.Forms.Label();
this.pnlDefaultCredentials.SuspendLayout();
this.SuspendLayout();
//
// checkBoxUnlockOnStartup
@@ -42,14 +54,134 @@
this.checkBoxUnlockOnStartup.Text = "Prompt to unlock credential repositories on startup";
this.checkBoxUnlockOnStartup.UseVisualStyleBackColor = true;
//
// pnlDefaultCredentials
//
this.pnlDefaultCredentials.Controls.Add(this.radCredentialsCustom);
this.pnlDefaultCredentials.Controls.Add(this.lblDefaultCredentials);
this.pnlDefaultCredentials.Controls.Add(this.radCredentialsNoInfo);
this.pnlDefaultCredentials.Controls.Add(this.radCredentialsWindows);
this.pnlDefaultCredentials.Controls.Add(this.txtCredentialsDomain);
this.pnlDefaultCredentials.Controls.Add(this.lblCredentialsUsername);
this.pnlDefaultCredentials.Controls.Add(this.txtCredentialsPassword);
this.pnlDefaultCredentials.Controls.Add(this.lblCredentialsPassword);
this.pnlDefaultCredentials.Controls.Add(this.txtCredentialsUsername);
this.pnlDefaultCredentials.Controls.Add(this.lblCredentialsDomain);
this.pnlDefaultCredentials.Location = new System.Drawing.Point(3, 38);
this.pnlDefaultCredentials.Name = "pnlDefaultCredentials";
this.pnlDefaultCredentials.Size = new System.Drawing.Size(596, 175);
this.pnlDefaultCredentials.TabIndex = 13;
//
// radCredentialsCustom
//
this.radCredentialsCustom.AutoSize = true;
this.radCredentialsCustom.Location = new System.Drawing.Point(16, 69);
this.radCredentialsCustom.Name = "radCredentialsCustom";
this.radCredentialsCustom.Size = new System.Drawing.Size(87, 17);
this.radCredentialsCustom.TabIndex = 3;
this.radCredentialsCustom.Text = "the following:";
this.radCredentialsCustom.UseVisualStyleBackColor = true;
this.radCredentialsCustom.CheckedChanged += new System.EventHandler(this.radCredentialsCustom_CheckedChanged);
//
// lblDefaultCredentials
//
this.lblDefaultCredentials.AutoSize = true;
this.lblDefaultCredentials.Location = new System.Drawing.Point(3, 9);
this.lblDefaultCredentials.Name = "lblDefaultCredentials";
this.lblDefaultCredentials.Size = new System.Drawing.Size(257, 13);
this.lblDefaultCredentials.TabIndex = 0;
this.lblDefaultCredentials.Text = "For empty Username, Password or Domain fields use:";
//
// radCredentialsNoInfo
//
this.radCredentialsNoInfo.AutoSize = true;
this.radCredentialsNoInfo.Checked = true;
this.radCredentialsNoInfo.Location = new System.Drawing.Point(16, 31);
this.radCredentialsNoInfo.Name = "radCredentialsNoInfo";
this.radCredentialsNoInfo.Size = new System.Drawing.Size(91, 17);
this.radCredentialsNoInfo.TabIndex = 1;
this.radCredentialsNoInfo.TabStop = true;
this.radCredentialsNoInfo.Text = "no information";
this.radCredentialsNoInfo.UseVisualStyleBackColor = true;
//
// radCredentialsWindows
//
this.radCredentialsWindows.AutoSize = true;
this.radCredentialsWindows.Location = new System.Drawing.Point(16, 50);
this.radCredentialsWindows.Name = "radCredentialsWindows";
this.radCredentialsWindows.Size = new System.Drawing.Size(227, 17);
this.radCredentialsWindows.TabIndex = 2;
this.radCredentialsWindows.Text = "my current credentials (windows logon info)";
this.radCredentialsWindows.UseVisualStyleBackColor = true;
//
// txtCredentialsDomain
//
this.txtCredentialsDomain.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtCredentialsDomain.Enabled = false;
this.txtCredentialsDomain.Location = new System.Drawing.Point(140, 147);
this.txtCredentialsDomain.Name = "txtCredentialsDomain";
this.txtCredentialsDomain.Size = new System.Drawing.Size(150, 20);
this.txtCredentialsDomain.TabIndex = 9;
//
// lblCredentialsUsername
//
this.lblCredentialsUsername.Enabled = false;
this.lblCredentialsUsername.Location = new System.Drawing.Point(37, 95);
this.lblCredentialsUsername.Name = "lblCredentialsUsername";
this.lblCredentialsUsername.Size = new System.Drawing.Size(97, 13);
this.lblCredentialsUsername.TabIndex = 4;
this.lblCredentialsUsername.Text = "Username:";
this.lblCredentialsUsername.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// txtCredentialsPassword
//
this.txtCredentialsPassword.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtCredentialsPassword.Enabled = false;
this.txtCredentialsPassword.Location = new System.Drawing.Point(140, 120);
this.txtCredentialsPassword.Name = "txtCredentialsPassword";
this.txtCredentialsPassword.Size = new System.Drawing.Size(150, 20);
this.txtCredentialsPassword.TabIndex = 7;
this.txtCredentialsPassword.UseSystemPasswordChar = true;
//
// lblCredentialsPassword
//
this.lblCredentialsPassword.Enabled = false;
this.lblCredentialsPassword.Location = new System.Drawing.Point(34, 123);
this.lblCredentialsPassword.Name = "lblCredentialsPassword";
this.lblCredentialsPassword.Size = new System.Drawing.Size(100, 13);
this.lblCredentialsPassword.TabIndex = 6;
this.lblCredentialsPassword.Text = "Password:";
this.lblCredentialsPassword.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// txtCredentialsUsername
//
this.txtCredentialsUsername.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtCredentialsUsername.Enabled = false;
this.txtCredentialsUsername.Location = new System.Drawing.Point(140, 93);
this.txtCredentialsUsername.Name = "txtCredentialsUsername";
this.txtCredentialsUsername.Size = new System.Drawing.Size(150, 20);
this.txtCredentialsUsername.TabIndex = 5;
//
// lblCredentialsDomain
//
this.lblCredentialsDomain.Enabled = false;
this.lblCredentialsDomain.Location = new System.Drawing.Point(34, 150);
this.lblCredentialsDomain.Name = "lblCredentialsDomain";
this.lblCredentialsDomain.Size = new System.Drawing.Size(100, 13);
this.lblCredentialsDomain.TabIndex = 8;
this.lblCredentialsDomain.Text = "Domain:";
this.lblCredentialsDomain.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// CredentialsPage
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.pnlDefaultCredentials);
this.Controls.Add(this.checkBoxUnlockOnStartup);
this.Name = "CredentialsPage";
this.PageIcon = ((System.Drawing.Icon)(resources.GetObject("$this.PageIcon")));
this.Size = new System.Drawing.Size(610, 489);
this.pnlDefaultCredentials.ResumeLayout(false);
this.pnlDefaultCredentials.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@@ -58,5 +190,16 @@
#endregion
private System.Windows.Forms.CheckBox checkBoxUnlockOnStartup;
internal System.Windows.Forms.Panel pnlDefaultCredentials;
internal System.Windows.Forms.RadioButton radCredentialsCustom;
internal System.Windows.Forms.Label lblDefaultCredentials;
internal System.Windows.Forms.RadioButton radCredentialsNoInfo;
internal System.Windows.Forms.RadioButton radCredentialsWindows;
internal System.Windows.Forms.TextBox txtCredentialsDomain;
internal System.Windows.Forms.Label lblCredentialsUsername;
internal System.Windows.Forms.TextBox txtCredentialsPassword;
internal System.Windows.Forms.Label lblCredentialsPassword;
internal System.Windows.Forms.TextBox txtCredentialsUsername;
internal System.Windows.Forms.Label lblCredentialsDomain;
}
}

View File

@@ -1,4 +1,8 @@
namespace mRemoteNG.UI.Forms.OptionsPages
using System;
using mRemoteNG.App;
using mRemoteNG.Security.SymmetricEncryption;
namespace mRemoteNG.UI.Forms.OptionsPages
{
public partial class CredentialsPage : OptionsPage
{
@@ -16,18 +20,74 @@
{
base.ApplyLanguage();
checkBoxUnlockOnStartup.Text = Language.PromptUnlockCredReposOnStartup;
lblDefaultCredentials.Text = Language.strEmptyUsernamePasswordDomainFields;
radCredentialsNoInfo.Text = Language.strNoInformation;
radCredentialsWindows.Text = Language.strMyCurrentWindowsCreds;
radCredentialsCustom.Text = Language.strTheFollowing;
lblCredentialsUsername.Text = Language.strLabelUsername;
lblCredentialsPassword.Text = Language.strLabelPassword;
lblCredentialsDomain.Text = Language.strLabelDomain;
}
public override void LoadSettings()
{
base.SaveSettings();
checkBoxUnlockOnStartup.Checked = Settings.Default.PromptUnlockCredReposOnStartup;
// ReSharper disable once SwitchStatementMissingSomeCases
switch (Settings.Default.EmptyCredentials)
{
case "noinfo":
radCredentialsNoInfo.Checked = true;
break;
case "windows":
radCredentialsWindows.Checked = true;
break;
case "custom":
radCredentialsCustom.Checked = true;
break;
}
txtCredentialsUsername.Text = Settings.Default.DefaultUsername;
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
txtCredentialsPassword.Text = cryptographyProvider.Decrypt(Settings.Default.DefaultPassword, Runtime.EncryptionKey);
txtCredentialsDomain.Text = Settings.Default.DefaultDomain;
}
public override void SaveSettings()
{
Settings.Default.PromptUnlockCredReposOnStartup = checkBoxUnlockOnStartup.Checked;
if (radCredentialsNoInfo.Checked)
{
Settings.Default.EmptyCredentials = "noinfo";
}
else if (radCredentialsWindows.Checked)
{
Settings.Default.EmptyCredentials = "windows";
}
else if (radCredentialsCustom.Checked)
{
Settings.Default.EmptyCredentials = "custom";
}
Settings.Default.DefaultUsername = txtCredentialsUsername.Text;
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
Settings.Default.DefaultPassword = cryptographyProvider.Encrypt(txtCredentialsPassword.Text, Runtime.EncryptionKey);
Settings.Default.DefaultDomain = txtCredentialsDomain.Text;
Settings.Default.Save();
}
private void radCredentialsCustom_CheckedChanged(object sender, EventArgs e)
{
lblCredentialsUsername.Enabled = radCredentialsCustom.Checked;
lblCredentialsPassword.Enabled = radCredentialsCustom.Checked;
lblCredentialsDomain.Enabled = radCredentialsCustom.Checked;
txtCredentialsUsername.Enabled = radCredentialsCustom.Checked;
txtCredentialsPassword.Enabled = radCredentialsCustom.Checked;
txtCredentialsDomain.Enabled = radCredentialsCustom.Checked;
}
}
}

View File

@@ -316,6 +316,12 @@
<Compile Include="UI\Controls\ConnectionTree\ConnectionTree.Designer.cs">
<DependentUpon>ConnectionTree.cs</DependentUpon>
</Compile>
<Compile Include="UI\Controls\CredentialRecordComboBox.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="UI\Controls\CredentialRecordComboBox.Designer.cs">
<DependentUpon>CredentialRecordComboBox.cs</DependentUpon>
</Compile>
<Compile Include="UI\Controls\CredentialRecordListAdaptor.cs" />
<Compile Include="UI\Controls\CredentialRecordListBox.cs">
<SubType>Component</SubType>