Created
April 3, 2013 20:17
-
-
Save mattpresson/5304833 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HttpPost] | |
public ActionResult LogOn(LogOnModel model, string returnUrl) | |
{ | |
if (ModelState.IsValid) | |
{ | |
if (MembershipService.ValidateUser(model.UserName, model.Password)) | |
{ | |
FormsService.SignIn(model.UserName, model.RememberMe); | |
if (!String.IsNullOrEmpty(returnUrl)) | |
{ | |
return Redirect(returnUrl); | |
} | |
else | |
{ | |
return RedirectToAction("Index", "Home"); | |
} | |
} | |
else | |
{ | |
ModelState.AddModelError("", "The user name or password provided is incorrect."); | |
} | |
} | |
// If we got this far, something failed, redisplay form | |
return View(model); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment