예제 #1
0
 public ActionResult LogOn(LogOnModel model, string returnUrl)
 {
     if (ModelState.IsValid)
     {
         if (_userRepository.ValidateUser(model.UserName, model.Password))
         {
             FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe);
             if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/")
                 && !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\"))
             {
                 return Redirect(returnUrl);
             }
             return RedirectToAction("Entries", "Blog");
         }
         ModelState.AddModelError("", "The user name or password provided is incorrect.");
     }
     return View(model);
 }
예제 #2
0
 public ActionResult LogOn()
 {
     var model = new LogOnModel();
     model.PageTitle = "Log On";
     return View(model);
 }