コード例 #1
0
        public ActionResult Index(LoginViewModel model)
        {
            var user = _userService.ByUsernameAndPassword(model.Username, model.Password);

            if (user == null)
                return FailedLogin(model);

            _sessionAuthentication.Start(user, model.RememberMe);

            return Redirect(ReturnUrl);
        }
コード例 #2
0
 /// <summary>
 /// Gets the view & its data organised for a failed
 /// login, giving feedback to the user.
 /// </summary>
 /// <returns>The login form.</returns>
 private ViewResult FailedLogin(LoginViewModel model)
 {
     ViewData["Feedback"] = LoginFailedFeedback;
     return View(model);
 }