private void button_OK_Click(object sender, System.EventArgs e) { AccessLevel newAccessLevel = ((AccessLevel_Localized)(comboBox_Login.SelectedItem)).val; bool isSuccess = true; if (newAccessLevel > mCurrentAccessLevel) { string expected = mPasswordFile.GetPasswordForAccessLevel(newAccessLevel); if (expected != "") { this.Text = ResourceUtility.FormatString("RtEnterPassword", newAccessLevel.ToString()); string enteredPassword = this.textBox_Password.Text; if (enteredPassword != expected) { isSuccess = false; MessageBox.Show(ResourceUtility.GetString("RtInvalidPassword2"), ResourceUtility.GetString("RtInvalidPassword")); } } } if (isSuccess) { mCurrentAccessLevel = newAccessLevel; this.DialogResult = DialogResult.OK; this.Close(); MessageLoggerManager.Log.Info("[Action] Log-in as " + mCurrentAccessLevel.ToString()); } //else //{ // this.DialogResult = DialogResult.Cancel; //} }
private void FormSetPasswords_Load(object sender, System.EventArgs e) { this.Text = ResourceUtility.GetString("RtSetPasswordsTitle"); this.groupBox_Administrator.Text = ResourceUtility.GetString("RtAdministrator"); this.groupBox_Supervisor.Text = ResourceUtility.GetString("RtSupervisor"); this.label_ConfirmPassword1.Text = ResourceUtility.GetString("RtConfirmPassword"); this.label_ConfirmPassword2.Text = this.label_ConfirmPassword1.Text; this.label_Password1.Text = ResourceUtility.GetString("RtPassword"); this.label_Password2.Text = this.label_Password1.Text; this.button_Cancel.Text = ResourceUtility.GetString("RtCancel"); this.button_OK.Text = ResourceUtility.GetString("RtOK"); this.textBox_SupervisorPassword.Text = mPasswordFile.GetPasswordForAccessLevel(AccessLevel.Supervisor); this.textBox_SupervisorConfirm.Text = this.textBox_SupervisorPassword.Text; this.textBox_AdministratorPassword.Text = mPasswordFile.GetPasswordForAccessLevel(AccessLevel.Administrator); this.textBox_AdministratorConfirm.Text = this.textBox_AdministratorPassword.Text; EnableOk(); }
public FormPasswordPrompt(PasswordFile currentPasswordFile, AccessLevel currentAccessLevel) { // // Required for Windows Form Designer support // InitializeComponent(); comboBox_Login.Items.Add(new AccessLevel_Localized(AccessLevel.Operator, ResourceUtility.GetString("RtOperator"))); comboBox_Login.Items.Add(new AccessLevel_Localized(AccessLevel.Supervisor, ResourceUtility.GetString("RtSupervisor"))); comboBox_Login.Items.Add(new AccessLevel_Localized(AccessLevel.Administrator, ResourceUtility.GetString("RtAdministrator"))); mPasswordFile = currentPasswordFile; CurrentAccessLevel = currentAccessLevel; comboBox_Login.SelectedIndex = (int)currentAccessLevel; foreach (AccessLevel_Localized al in comboBox_Login.Items) { if (al.val == mCurrentAccessLevel) { comboBox_Login.SelectedItem = al; } } }
private void FormPasswordPrompt_Load(object sender, System.EventArgs e) { this.label_Password.Text = ResourceUtility.GetString("RtPassword"); this.button_OK.Text = ResourceUtility.GetString("RtOK"); this.button_Cancel.Text = ResourceUtility.GetString("RtCancel"); }