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);
        }
Esempio 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.");
            }
        }