示例#1
0
        public JsonResult LogIn(LogInModel model)
        {
            if (ModelState.IsValid && m_UserService.ValidateUser(model))
            {
                var rememberMe = model.RememberMe.HasValue && model.RememberMe.Value;
                m_AuthService.SetAuthCookie(model.Email, rememberMe);
                return JsonSuccess(new { IsLoggedIn = true });
            }

            return JsonSuccess(new { IsLoggedIn = false, Error = "The user name and password provided are incorrect." });
        }
示例#2
0
 public bool ValidateUser(LogInModel model)
 {
     return s_UsersToPasswords.ContainsKey(model.Email)
         && s_UsersToPasswords[model.Email] == model.Password;
 }