コード例 #1
0
 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);
 }
コード例 #2
0
 private bool CheckCredentials(LogOnViewModel model)
 {
     return Configuration.AdminUserName == model.UserName && Configuration.AdminPassword == model.Password;
 }