Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public ActionResult Login()
- {
- return View();
- }
- [HttpPost]
- public ActionResult Login(LoginModel model, string returnUrl)
- {
- if (!ModelState.IsValid)
- return View(model);
- var password = PasswordHash.Encrypt(model.Password);
- var user = _userManagerService.GetUser(model.Username, password);
- if (user != null)
- {
- FormsAuthHelper.SetAuthenticationCookie(Response, user);
- if (returnUrl.Length > 1)
- {
- return Redirect(returnUrl);
- }
- return RedirectToAction("Index", "Invoice");
- }
- ModelState.AddModelError("", "The user name or password provided is incorrect.");
- // If we got this far, something failed, redisplay form
- return View(model);
- }
Add Comment
Please, Sign In to add comment