예제 #1
0
        private void ChangePinButton_Click(object sender, EventArgs e)
        {
            string newPin     = NewPinTextBox.Text;
            string confirmPin = ConfirmTextBox.Text;

            if (newPin.Equals("") || confirmPin.Equals(""))
            {
                MessageBox.Show("All fields are required.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                FormUtilities.ClearTextBoxes(NewPinTextBox, ConfirmTextBox, ConfirmTextBox);
                return;
            }

            if (!newPin.Equals(confirmPin))
            {
                MessageBox.Show("New PIN and PIN confirmation do not match.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                FormUtilities.ClearTextBoxes(NewPinTextBox, ConfirmTextBox);
                return;
            }

            DBManager.UpdateValueWhere("Users", "Pin", newPin, "Login", LoggedUser.Login);
            MessageBox.Show("PIN has been successfully changed.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);

            this.Close();
            FormUtilities.EnableControls(DisabledControls);
        }
        private void ChangePasswordButton_Click(object sender, EventArgs e)
        {
            string oldPassword     = OldPasswordTextBox.Text;
            string newPassword     = NewPasswordTextBox.Text;
            string confirmPassword = ConfirmTextBox.Text;

            if (oldPassword.Equals("") || newPassword.Equals("") || confirmPassword.Equals(""))
            {
                MessageBox.Show("All fields are required.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                FormUtilities.ClearTextBoxes(OldPasswordTextBox, NewPasswordTextBox, ConfirmTextBox);
                return;
            }

            if (!oldPassword.Equals(DBManager.GetSingleValueWhere("Users", "Password", "Login", LoggedUser.Login)))
            {
                MessageBox.Show("Invalid old password.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                FormUtilities.ClearTextBoxes(OldPasswordTextBox, NewPasswordTextBox, ConfirmTextBox);
                return;
            }

            if (newPassword.Length < 8)
            {
                MessageBox.Show("Password must be at least 8 characters long.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                FormUtilities.ClearTextBoxes(OldPasswordTextBox, NewPasswordTextBox, ConfirmTextBox);
                return;
            }

            if (!newPassword.Equals(confirmPassword))
            {
                MessageBox.Show("New password and password confirmation do not match.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                FormUtilities.ClearTextBoxes(OldPasswordTextBox, NewPasswordTextBox, ConfirmTextBox);
                return;
            }

            DBManager.UpdateValueWhere("Users", "Password", newPassword, "Login", LoggedUser.Login);
            MessageBox.Show("Password has been successfully changed.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);

            this.Close();
            FormUtilities.EnableControls(DisabledControls);
        }
 private void ChangePasswordForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     FormUtilities.EnableControls(DisabledControls);
 }
 private void VerificationCodeForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     FormUtilities.EnableControls(DisabledControls);
 }
예제 #5
0
 private void RegisterForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     FormUtilities.EnableControls(DisabledControls);
 }
예제 #6
0
 private void AccountForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     FormUtilities.EnableControls(DisabledControls.ToArray());
 }