private void AcceptButton_Click(object sender, System.EventArgs e)
 {
     if (isFieldsCorrect())
     {
         if (PhoneTextBox.MaskCompleted)
         {
             Reader reader = readerBL.GetReaderByLogin(LoginTextBox.Text);
             if (reader.Phone == PhoneTextBox.Text)
             {
                 if (NewPasswordTextBox.Text == ConfirmPassTextBox.Text)
                 {
                     authorization.SetNewPassword(reader, NewPasswordTextBox.Text);
                     MessageBox.Show("Password changed, try to sign in");
                     Close();
                 }
                 else
                 {
                     MessageBox.Show("Passwords do not match");
                 }
             }
             else
             {
                 MessageBox.Show("User with this login has a different phone number");
             }
         }
         else
         {
             MessageBox.Show("Wrong phone number");
         }
     }
     else
     {
         MessageBox.Show("Fill in empty fields");
     }
 }
Exemple #2
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");
            }
        }