public ActionResult LogOn(LogOnModel model, string returnUrl) { if (ModelState.IsValid) { OCC.UI.Webhost.CodeCampService.Person authenticatedPerson = null; OCC.UI.Webhost.CodeCampService.Person person = service.FindPersonByEmail(model.Email); if (person == null) { ModelState.AddModelError("", ""); return View(model); //RedirectToAction("LogOn", "Account"); } else { person.PasswordHash = HashProvider.GenerateUserNamePasswordHash(model.Email, model.Password); authenticatedPerson = service.Login(person); } if (authenticatedPerson != null) { return RedirectToAction("Index", "Home"); } else { ModelState.AddModelError("", "The user name or password provided is incorrect."); } } return View(model); }
public ActionResult LogOn(LogOnModel model, string returnUrl, FormCollection frm) { if (ModelState.IsValid) { CodeCampService.Person authenticatedPerson = null; CodeCampService.Person person = service.FindPersonByEmail(model.Email); if (person == null) { ModelState.AddModelError("", ""); return View(model); //RedirectToAction("LogOn", "Account"); } else { person.PasswordHash = HashProvider.ComputePasswordHash(model.Password); authenticatedPerson = service.Login(person); } if (authenticatedPerson != null) { bool rememberMe = frm["rememberMe"] == "on"; SetFormsAuth(authenticatedPerson, rememberMe); if (string.IsNullOrEmpty(authenticatedPerson.Location)) { return RedirectToAction("UpdateProfile", "Account"); } else { return RedirectToAction("Index", "Home"); } } else { ModelState.AddModelError("", "The user name or password provided is incorrect."); } } return View(model); }