public ActionResult Login(vmAccountLogin model, string returnUrl) { Session.Clear(); if (ModelState.IsValid) { if (Membership.ValidateUser(model.UserName, model.Password)) { FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe); T_OE_USERS u = db_Accounts.GetT_OE_USERSByID(model.UserName); if (u.INITAL_PWD_FLAG) { return(RedirectToAction("SetPermPassword")); } else { db_Accounts.UpdateT_OE_USERS(u.USER_IDX, null, null, null, null, null, null, null, null, System.DateTime.Now, null, null, null, null, null, null); return(RedirectToAction("Index", "Dashboard")); } } } // If we got this far, something failed, redisplay form TempData["Error"] = "The user name or password provided is incorrect."; //ModelState.AddModelError("", "The user name or password provided is incorrect."); return(View(model)); }
public ActionResult Login(string returnUrl) { //auto pass forward to dashboard if logged in T_OE_USERS u = db_Accounts.GetT_OE_USERSByID(User.Identity.Name); if (u != null) { if (u.ACT_IND == true) { return(RedirectToAction("Index", "Dashboard")); } } var model = new vmAccountLogin { RememberMe = true }; ViewBag.ReturnUrl = returnUrl; return(View(model)); }