예제 #1
0
 public string ConfirmEmail(string userConfirmationToken)
 {
     if (_userManager.ConfirmEmail(userConfirmationToken))
     {
         var userId = _userManager.GetUserByConfirmationToken(userConfirmationToken).UserId;
         return(_tokenManager.AssignToken(userId));
     }
     return(null);
 }
예제 #2
0
        public string SignInUser(string userEmail, string password)
        {
            var user = _context.UserValues.Where(x => x.UserEmail == userEmail).First <User>();

            if (user != null)
            {
                var userAccountStatus = _userManager.GetUserConfirmationStatus(user);
                if (HashingAlgorithms.VerifyPassword(user.UserPass, password))
                {
                    if (userAccountStatus != null)
                    {
                        if (userAccountStatus.UserAccountConfirmed)
                        {
                            return(_tokenManager.AssignToken(user.UserId));
                        }
                        return("UnconfirmedEmail"); // If the user account has not been confirmed this string will be returned to indicate that an uncofirmed email has attempted to sign in
                    }
                }
                return(null);
            }
            return(null);
        }