public async Task<ActionResult> Login(LoginObjectEntity model) { if (ModelState.IsValid) { if (model != null) { if (model.Password != "" && model.UserName != "") { bool isSuperAdmin = false; string sUserID = ""; string sEmail = ""; if (authenticateProvider.Authenticate(model.UserName, model.Password, ref isSuperAdmin, ref sUserID, ref sEmail)) { Session["EmpID"] = sUserID; Session["LoginID"] = model.UserName; Session["EmpEmail"] = sEmail; if (isSuperAdmin) { Session["isSuperAdmin"] = "1"; } else { Session["isSuperAdmin"] = "0"; } return RedirectToAction("Category"); } } } else { ModelState.AddModelError("", "Invalid username or password."); } } // If we got this far, something failed, redisplay form ModelState.AddModelError("", "Invalid username or password."); return View(model); }
public ActionResult Login() { LoginObjectEntity model = new LoginObjectEntity(); return View(model); }