Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // POST: /Account/Login
- [HttpPost]
- [AllowAnonymous]
- [ValidateAntiForgeryToken]
- public async Task<ActionResult> Login(LoginViewModel model, string returnUrl)
- {
- if (!ModelState.IsValid)
- {
- return View(model);
- }
- // This doesn't count login failures towards account lockout
- // To enable password failures to trigger account lockout, change to shouldLockout: true
- var result = await SignInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, shouldLockout: false);
- switch (result)
- {
- case SignInStatus.Success:
- return RedirectToLocal(returnUrl);
- case SignInStatus.LockedOut:
- return View("Lockout");
- case SignInStatus.RequiresVerification:
- return RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = model.RememberMe });
- case SignInStatus.Failure:
- default:
- ModelState.AddModelError("", "Invalid login attempt.");
- return View(model);
- }
- }
- //
- // Summary:
- // Sign in the user in using the user name and password
- //
- // Parameters:
- // userName:
- //
- // password:
- //
- // isPersistent:
- //
- // shouldLockout:
- [AsyncStateMachine(typeof(SignInManager<,>.<PasswordSignInAsync>d__29))]
- [DebuggerStepThrough]
- public virtual Task<SignInStatus> PasswordSignInAsync(string userName, string password, bool isPersistent, bool shouldLockout);
Add Comment
Please, Sign In to add comment