Ejemplo n.º 1
0
        private void AcceptButton_Click(object sender, EventArgs e)
        {
            string realpassword = authorization.GetPasswordForLogin(_reader.Login);

            if (!string.IsNullOrEmpty(ConfirmPassTextBox.Text) && !string.IsNullOrEmpty(NewPasswordTextBox.Text) && !string.IsNullOrEmpty(OldPasswordTextBox.Text))
            {
                if (realpassword == OldPasswordTextBox.Text && NewPasswordTextBox.Text == ConfirmPassTextBox.Text)
                {
                    authorization.SetNewPassword(_reader, NewPasswordTextBox.Text);
                    MessageBox.Show($"Password succesfuly changed.");
                    Close();
                }
                else if (realpassword != OldPasswordTextBox.Text)
                {
                    MessageBox.Show("Wrong old password");
                }
                else if (NewPasswordTextBox.Text != ConfirmPassTextBox.Text)
                {
                    MessageBox.Show("Passwords do not match");
                }
            }
            else
            {
                MessageBox.Show("Enter empty field");
            }
        }