Esempio n. 1
0
 public ActionResult Index(LoginViewModel model)
 {
     if (ModelState.IsValid)
     {
         var user = this.authService.AuthenticateUser(model.UserName, model.Password.Hashstring());
         if (user != null)
         {
             FormsAuthenticationUtility.SetFormsAuthenticationTicketFromLoginUser(user);
             return(RedirectToAction("Index", "Home"));
         }
     }
     ViewData["errorMessage"] = "The user name or the password are incorrect, please check your user name and password and try again.";
     return(View());
 }
Esempio n. 2
0
 void Application_PostAuthenticateRequest(object sender, EventArgs e)
 {
     FormsAuthenticationUtility.GetFormsAuthenticationUserFromAuthenticationCookies();
 }