Beispiel #1
0
 public User GetUser()
 {
     if (this.status != LoginStatus.LoginSuccess)
     {
         throw new Exception("Login unsuccessful, access not granted");
     }
     return(userResult.GetUser());
 }
Beispiel #2
0
        public LoginResult LoginUser(string username, string password)
        {
            UserResult userResult = GetUser(username);

            if (userResult.GetStatus() == UserResult.UserResultStatus.NOTFOUND)
            {
                return(new LoginResult(LoginResult.LoginStatus.InvalidUser));
            }
            string passHash = GetPasswordHash(password);

            if (userResult.GetUser().Password != passHash)
            {
                return(new LoginResult(LoginResult.LoginStatus.InvalidPassword));
            }
            return(new LoginResult(userResult));
        }