//[ValidateAntiForgeryToken] public ActionResult Login(LoginModel model, string returnUrl) { string errorMsg = "The user name or password provided is incorrect."; if (model.IsConfirmed) { if (ModelState.IsValid && WebSecurity.Login(model.UserName, model.Password, persistCookie: model.RememberMe)) { return RedirectToLocal(returnUrl); } else if (WebSecurity.FoundUser(model.UserName) && !WebSecurity.IsConfirmed(model.UserName)) { model.IsConfirmed = false; errorMsg = "You have not completed the registration process. To complete this process look for the email that provides instructions or press the button to resend the email."; } } else //Need to resend confirmation email { ResendConfirmationEmail(model.UserName); errorMsg = "The registration email has been resent. Find the email and follow the instructions to complete the registration process."; model.IsConfirmed = true; } // If we got this far, something failed, redisplay form ModelState.AddModelError("", errorMsg); return View(model); }
public ActionResult Login(LoginModel model, string returnUrl) { if (ModelState.IsValid && WebSecurity.Login(model.UserName, model.Password, persistCookie: false)) { return RedirectToLocal(returnUrl); } // If we got this far, something failed, redisplay form ModelState.AddModelError("", "The user name or password provided is incorrect."); return View(model); }
public ActionResult Login(string returnUrl) { ViewBag.ReturnUrl = returnUrl; LoginModel model = new LoginModel() { IsConfirmed = true }; return View(model); }