예제 #1
0
 private void btnSave_Click(object sender, System.EventArgs e)
 {
     if (txtOldPassword.Text == RSACoder.Decryption(AppUser.Instance.Password))
     {
         if (txtNewPassword.Text == txtRepeatPassword.Text)
         {
             if (AppUser.Instance.ChangePassword(txtOldPassword.Text, txtNewPassword.Text))
             {
                 MessageBox.Show("Hasło zostało zmienione.", "Zmiana hasła", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 this.Close();
             }
             else
             {
                 MessageBox.Show("Nie udało sie zmienić hasła, spróbuj ponownie.", "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else
         {
             MessageBox.Show("Nowe hasła nie zgadzają się!", "Niepoprawne hasło", MessageBoxButtons.OK, MessageBoxIcon.Stop);
         }
     }
     else
     {
         MessageBox.Show("Niepoprawne hasło!\r\nPodaj stare hasło ponownie.", "Niepoprawne hasło", MessageBoxButtons.OK, MessageBoxIcon.Stop);
     }
 }
예제 #2
0
 private void btnSave_Click(object sender, System.EventArgs e)
 {
     if (this.IsDataVerified())
     {
         this.Login        = txtLogin.Text;
         this.Password     = RSACoder.Encryption(txtNewPassword.Text);
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
 }