public ActionResult Login(LoginViewModel model, string returnUrl) { if (ModelState.IsValid) { if (authProvider.Authenticate(model.UserName, model.Password)) { LoggedIn.username = model.UserName; if (LoggedIn.username == "Admin") { return(Redirect(returnUrl ?? Url.Action("Index", "Home"))); } else { return(Redirect(returnUrl ?? Url.Action("UserMain", "User"))); } } else { ModelState.AddModelError("", "Incorrect username or password"); return(View()); } } else { return(View()); } }
public ActionResult Login(LoginViewModel model, string returnUrl) { Authprovider fAuth = new Authprovider(); if (ModelState.IsValid) { if (fAuth.Authenticate(model.UserName, model.Password)) { LoggedIn.username = model.UserName; return(Redirect("UserMain")); } else { ModelState.AddModelError("", "Incorrect username or password"); } } return(View()); }