public virtual ActionResult LogOn(LogOnViewModel model) { if (ModelState.IsValid && CheckCredentials(model)) { FormsAuthentication.SetAuthCookie(model.UserName, false); var redirectUrl = FormsAuthentication.GetRedirectUrl(model.UserName, false); if (string.IsNullOrEmpty(redirectUrl)) { return RedirectToAction("Index", "Article"); } else { return Redirect(redirectUrl); } } return View(model); }
private bool CheckCredentials(LogOnViewModel model) { return Configuration.AdminUserName == model.UserName && Configuration.AdminPassword == model.Password; }