mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
REPO-1627: oldPassword/password validation improvement
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@133094 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -519,6 +519,10 @@ public class PeopleImpl implements People
|
||||
// The user is not an admin user and is not attempting to update *their own* details.
|
||||
throw new PermissionDeniedException();
|
||||
}
|
||||
if (!isAdminAuthority() && person.getOldPassword() != null && person.getPassword() == null)
|
||||
{
|
||||
throw new IllegalArgumentException("To change password, both 'oldPassword' and 'password' fields are required.");
|
||||
}
|
||||
|
||||
final String personIdToUpdate = validatePerson(personId);
|
||||
final Map<QName, Serializable> properties = person.toProperties();
|
||||
|
@@ -1030,6 +1030,10 @@ public class TestPeople extends EnterpriseTestApi
|
||||
|
||||
// update with no oldPassword
|
||||
people.update(me.getId(), qjson("{ `password`:`newpassword456` }"), 403);
|
||||
|
||||
// update with no password
|
||||
people.update(me.getId(), qjson("{ `oldPassword`:`newpassword456`, `password`:`` }"), 400);
|
||||
people.update(me.getId(), qjson("{ `oldPassword`:`newpassword456` }"), 400);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Reference in New Issue
Block a user