protected override DriverResult Editor(UserPart part, IUpdateModel updater, dynamic shapeHelper) { var editModel = new UserEditPasswordViewModel { User = part }; if (updater != null) { if (updater.TryUpdateModel(editModel, Prefix, null, null)) { if (!(string.IsNullOrEmpty(editModel.Password) && string.IsNullOrEmpty(editModel.ConfirmPassword))) { if (string.IsNullOrEmpty(editModel.Password) || string.IsNullOrEmpty(editModel.ConfirmPassword)) { updater.AddModelError("MissingPassword", T("Password or Confirm Password field is empty.")); } else { if (editModel.Password != editModel.ConfirmPassword) { updater.AddModelError("ConfirmPassword", T("Password confirmation must match.")); } var actUser = _membershipService.GetUser(part.UserName); _membershipService.SetPassword(actUser, editModel.Password); } IDictionary <string, LocalizedString> validationErrors; if (!_userService.PasswordMeetsPolicies(editModel.Password, out validationErrors)) { updater.AddModelErrors(validationErrors); } } } } return(Editor(part, shapeHelper)); }