public ActionResult ChangePassword(ChangePasswordModel model) { string msg; var user = LunaLogic.Current.MembershipProvider.GetCurrentUserInfo(); if (user == null) msg = "There seems to be an error. It appears your user was never created."; else LunaLogic.Current.MembershipProvider.ChangePassword(user.Username, model.NewPassword, model.OldPassword, out msg); if (msg != null) { model.ErrorMessage = msg; return View(model); } return RedirectToAction("Result", "Shared", new { @bsClass = BsClasses.success, @title = "Success", @text = "Your password has been successfully changed!", @button = true, @buttonText = "Dashboard", @buttonUrl = Url.Action("Dashboard", "Home") }); }
public ActionResult ChangePassword() { var model = new ChangePasswordModel(); model.Username = User.Identity.Name; return View(model); }