public ActionResult Login(RealEstateWebUI.Models.LogOnModel model, string returnUrl) { var manager = HttpContext.GetOwinContext().GetUserManager <AppUserManager>(); var user = manager.FindByEmail(model.Email); if (user != null) { if (model.Password.Equals(AppPasswordHasher.GetMD5Hash(user.Password))) { // Set auth cookie for authenticated user HttpContext.GetOwinContext().Authentication.SignIn(manager.CreateIdentity(user, DefaultAuthenticationTypes.ApplicationCookie)); return(RedirectToAction("index", "home", new { area = "client" })); } } // If we got this far, something failed, redisplay form return(View(model)); }
public UsersController() { _passwordHasher = new AppPasswordHasher(); }