Пример #1
0
        public User IsAuthenticatedUser(LoginUserModel model)
        {
            try
            {
                var user = _userService.GetByEmail(model.Email);

                if (user != null)
                {
                    if (!user.IsEmailVerified)
                    {
                        executeMessage = "Please verify your email first";
                        return(null);
                    }

                    if (String.Compare(CustomCrypto.Hash(model.Password), user.Password) == 0)
                    {
                        CustomFormsAuthentication.Login(user, model.RememberMe);
                        executeMessage = "";
                        return(user);
                    }
                    else
                    {
                        executeMessage = "Invalid user email or password";
                        return(null);
                    }
                }
                else
                {
                    executeMessage = "Invalid user email or password";
                    return(null);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                executeMessage = ex.Message;
                return(null);
            }
        }
Пример #2
0
 public bool SendResetPasswordCode(LoginUserModel model)
 {
     return(_userService.SendResetPasswordCode(model.Email));
 }