public static bool TryLogin(String username, SecureString securePassword)
        {
            bool successful = false;

            try
            {
                successful = UserHandler.VerifyPass(username, securePassword);
                if (successful)
                {
                    _currentUser = username;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            return(successful);
        }
Exemplo n.º 2
0
        private void ChangePassword()
        {
            var current = PwbCurrentPass.SecurePassword;

            if (UserHandler.VerifyPass(LoginHandler.CurrentUser, current))
            {
                var pass1 = PwbNewPass.SecurePassword;
                var pass2 = PwbPassConfirm.SecurePassword;
                if (Authenticator.MatchPasswords(pass1, pass2))
                {
                    UserHandler.SetPassword(LoginHandler.CurrentUser, pass1);
                    MessageBox.Show("Password set!");
                    Close();
                }
                else
                {
                    MessageBox.Show("New passwords do not match.");
                }
            }
            else
            {
                MessageBox.Show("Current password is incorrect.");
            }
        }
Exemplo n.º 3
0
 public static UserList Refresh()
 {
     return(new UserList(UserHandler.GetXMLFile()));
 }
Exemplo n.º 4
0
 private void SetPass_Click(object sender, RoutedEventArgs e)
 {
     UserHandler.SetPassword("admin", TxbNewPass.SecurePassword);
     MessageBox.Show("Password set!");
     TxbNewPass.Password = ""; // clear
 }