Common: - password file check extended

This commit is contained in:
Thomas Wiedebusch
2023-10-19 13:07:09 +02:00
parent 80c53f5b32
commit 5393db957b
7 changed files with 182 additions and 53 deletions
+9 -9
View File
@@ -32,7 +32,7 @@
this.btnGet = new System.Windows.Forms.Button();
this.btnSet = new System.Windows.Forms.Button();
this.txtPcbID = new System.Windows.Forms.TextBox();
this.txtPassword = new System.Windows.Forms.TextBox();
this.txtSkeletonKey = new System.Windows.Forms.TextBox();
this.lblPcbID = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.grpSetup = new System.Windows.Forms.GroupBox();
@@ -84,13 +84,13 @@
this.txtPcbID.TabIndex = 2;
this.txtPcbID.TextChanged += new System.EventHandler(this.txtPcbID_TextChanged);
//
// txtPassword
// txtSkeletonKey
//
this.txtPassword.Location = new System.Drawing.Point(118, 67);
this.txtPassword.Name = "txtPassword";
this.txtPassword.Size = new System.Drawing.Size(102, 20);
this.txtPassword.TabIndex = 3;
this.txtPassword.TextChanged += new System.EventHandler(this.txtPassword_TextChanged);
this.txtSkeletonKey.Location = new System.Drawing.Point(118, 67);
this.txtSkeletonKey.Name = "txtSkeletonKey";
this.txtSkeletonKey.Size = new System.Drawing.Size(102, 20);
this.txtSkeletonKey.TabIndex = 3;
this.txtSkeletonKey.TextChanged += new System.EventHandler(this.txtPassword_TextChanged);
//
// lblPcbID
//
@@ -203,7 +203,7 @@
this.grpDataBase.Controls.Add(this.barProgressDb);
this.grpDataBase.Controls.Add(this.label1);
this.grpDataBase.Controls.Add(this.lblPcbID);
this.grpDataBase.Controls.Add(this.txtPassword);
this.grpDataBase.Controls.Add(this.txtSkeletonKey);
this.grpDataBase.Controls.Add(this.txtPcbID);
this.grpDataBase.Controls.Add(this.btnSet);
this.grpDataBase.Controls.Add(this.btnGet);
@@ -303,7 +303,7 @@
private System.Windows.Forms.Button btnGet;
private System.Windows.Forms.Button btnSet;
private System.Windows.Forms.TextBox txtPcbID;
private System.Windows.Forms.TextBox txtPassword;
private System.Windows.Forms.TextBox txtSkeletonKey;
private System.Windows.Forms.Label lblPcbID;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.GroupBox grpSetup;
+8 -7
View File
@@ -104,14 +104,15 @@ namespace Xylem.Common.Ui.GenesisToolBox
}
var responseJson = sr.ReadToEnd();
//TODO THW hide skeleton key if read from DB
txtPassword.Text = responseJson.Trim('"');
//txtSkeletonKey.Text = responseJson.Trim('"');
txtSkeletonKey.Text = a.Skeleton;
txtLvl8.Text = autoPassword;
lblConnectDb.Text = @"Connected to PWD DB";
lblConnectDb.ForeColor = Color.Green;
////TODO TEST ONLY remove here _isReadyPasswordFile
_isReadyPasswordFile = true;
btnWritePwdFile.Enabled = true;
//btnWritePwdFile.Enabled = true;
////TODO remove until here
}));
@@ -140,7 +141,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
var passwordSetServiceUrl = ServiceUrls.GenesisSetPasswordServiceUrl();
#pragma warning restore CS0618 // Type or member is obsolete
var http = (HttpWebRequest)WebRequest.Create(passwordSetServiceUrl + txtPcbID.Text
+ "&Password=" + txtPassword.Text);
+ "&Password=" + txtSkeletonKey.Text);
var response = (HttpWebResponse)http.GetResponse();
var responseStream = response.GetResponseStream();
if (responseStream == null)
@@ -250,7 +251,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
lblConnectPcb.Text = StrNotConnected;
lblConnectPcb.ForeColor = Color.Red;
txtPcbID.Text = "";
txtPassword.Text = "";
txtSkeletonKey.Text = "";
btnGet.Enabled = false;
btnSet.Enabled = false;
if (!string.IsNullOrEmpty(cbComSlot.SelectedItem.ToString()) &&
@@ -324,7 +325,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
lblConnectDb.ForeColor = Color.Red;
btnConnect.Enabled = true;
txtPcbID.Text = "";
txtPassword.Text = "";
txtSkeletonKey.Text = "";
btnGet.Enabled = false;
btnSet.Enabled = false;
btnWritePwdFile.Enabled = false;
@@ -343,13 +344,13 @@ namespace Xylem.Common.Ui.GenesisToolBox
}
lblConnectDb.Text = StrNotConnected;
lblConnectDb.ForeColor = Color.Red;
txtPassword.Text = "";
txtSkeletonKey.Text = "";
}
private void txtPassword_TextChanged(Object sender, EventArgs e)
{
//setting is only allowed if genesis is not connected
if (txtPcbID.Text.Length > 7 && txtPassword.Text.Length == 12
if (txtPcbID.Text.Length > 7 && txtSkeletonKey.Text.Length == 12
&& lblConnectPcb.Text == StrNotConnected)
{
btnSet.Enabled = true;