public ActionResult ChangePassword(PasswordChangeViewModel model) { if (!Membership.ValidateUser(Membership.GetUser().UserName, model.OldPassword)) ModelState.AddModelError("OldPassword", "Incorrect Password"); if (!ModelState.IsValid) { return View(model); } _service.ChangePassword(model.OldPassword, model.NewPassword); TempData["message"] = "Password has been changed"; return RedirectToAction("Index", "Home", new { id = model.NavigationModel.Page.PageNavigation.Id}); }
public ActionResult ChangePassword(PasswordChangeViewModel model) { model.NavigationModel = HomeIndexViewModelLoader.Create(model.NavigationModel.Page.PageNavigation.Id, _service); if (!Membership.ValidateUser(Membership.GetUser().UserName, model.OldPassword)) ModelState.AddModelError("OldPassword", "Incorrect Password"); ModelState["NavigationModel.Page.Title"].Errors.Clear(); if (!ModelState.IsValid) { return View(model); } var user = Membership.GetUser(); user.ChangePassword(model.OldPassword, model.NewPassword); TempData["message"] = "Password has been changed"; return RedirectToAction("Index", "Home", new { id = model.NavigationModel.Page.PageNavigation.Id}); }
public ActionResult ChangePassword(int id, HomeIndexViewModel navModel) { var model = new PasswordChangeViewModel { }; model.NavigationModel = navModel; return View(model); }
public ActionResult ChangePassword(int id) { var model = new PasswordChangeViewModel { }; model.NavigationModel = HomeIndexViewModelLoader.Create(id, _service); return View(model); }