Simplifies the change password logic with the back office so an admin user can easily change another user's password if they have access to the users section. Updates the controllers to populate the modelstate correctly, changes name of HasAppAccess to HasSectionAccess. Ensure we don't have duplicate ysod dialogs when there is an error.

This commit is contained in:
Shannon
2017-09-04 22:03:03 +10:00
parent a0306f9d55
commit 7926a0c676
14 changed files with 76 additions and 37 deletions

View File

@@ -90,7 +90,7 @@ namespace Umbraco.Web.Editors
public async Task<ModelWithNotifications<string>> PostChangePassword(ChangingPasswordModel data)
{
var passwordChanger = new PasswordChanger(Logger, Services.UserService);
var passwordChangeResult = await passwordChanger.ChangePasswordWithIdentityAsync(Security.CurrentUser, Security.CurrentUser, data, ModelState, UserManager);
var passwordChangeResult = await passwordChanger.ChangePasswordWithIdentityAsync(Security.CurrentUser, Security.CurrentUser, data, UserManager);
if (passwordChangeResult.Success)
{
@@ -100,6 +100,11 @@ namespace Umbraco.Web.Editors
return result;
}
foreach (var memberName in passwordChangeResult.Result.ChangeError.MemberNames)
{
ModelState.AddModelError(memberName, passwordChangeResult.Result.ChangeError.ErrorMessage);
}
throw new HttpResponseException(Request.CreateValidationErrorResponse(ModelState));
}