public ActionResult ChangePassword(LocalPasswordModel.Password model) { WLogMembershipProvider provider = new WLogMembershipProvider(); if (!provider.ChangePassword(User.Identity.Name, model.OldPassword, model.NewPassword)) { UserProfileContext.Current.Refresh(); ModelState.AddModelError("", "Error"); RedirectToAction("Manage"); } else { return RedirectToAction("Index", "Private"); } return View(new LocalPasswordModel()); }
public ActionResult ChangeEmail(LocalPasswordModel.Email model) { if (ModelState.IsValid) { UserEntity entity = RepositoryContext.Current.Users.GetByUsername(User.Identity.Name); entity.Email = model.address; entity.LastActivityDate = DateTime.Now; RepositoryContext.Current.Users.Save(entity); UserProfileContext.Current.Refresh(); return RedirectToAction("Index", "Private"); } else { ModelState.AddModelError("", "Error"); } return View(); }
public ActionResult Manage() { LocalPasswordModel model = new LocalPasswordModel(); model.email.address = UserProfileContext.Current.User.Email; return View(model); }