Updated to move the logic for whether the password change can occur, into the controller,
This commit is contained in:
@@ -471,16 +471,17 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
|
||||
}
|
||||
|
||||
IUser currentUser = _backOfficeSecurityAccessor.BackOfficeSecurity.CurrentUser;
|
||||
// if the current user has access to reset/manually change the password
|
||||
if (currentUser.HasSectionAccess(Constants.Applications.Members) == false)
|
||||
{
|
||||
return new ValidationErrorResult("The current user is not authorized");
|
||||
}
|
||||
var changingPasswordModel = new ChangingPasswordModel
|
||||
{
|
||||
Id = intId.Result,
|
||||
OldPassword = contentItem.Password.OldPassword,
|
||||
NewPassword = contentItem.Password.NewPassword,
|
||||
CurrentUsername = currentUser.Username,
|
||||
SavingUserId = foundMember.Id,
|
||||
SavingUsername = foundMember.Username,
|
||||
CurrentUserHasSectionAccess = currentUser.HasSectionAccess(Constants.Applications.Members)
|
||||
};
|
||||
};
|
||||
|
||||
Attempt<PasswordChangedModel> passwordChangeResult = await _passwordChanger.ChangePasswordWithIdentityAsync(changingPasswordModel, _memberManager);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user