mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Addition of password update/set API for JavaScript People object:
- changePassword(string oldpw, string newpw) - changes password for the current user only, old password must be supplied - setPassword(string userName, string password) - set the password for the given user - only executable by an admin user Fix up and clean up of my-sites.get.js so that IMAP favorites are only retrieved if the IMAP server is enabled git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14280 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -273,6 +273,40 @@ public final class People extends BaseScopableProcessorExtension
|
|||||||
{
|
{
|
||||||
return this.mutableAuthenticationDao.getEnabled(userName);
|
return this.mutableAuthenticationDao.getEnabled(userName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change the password for the currently logged in user.
|
||||||
|
* Old password must be supplied.
|
||||||
|
*
|
||||||
|
* @param oldPassword Old user password
|
||||||
|
* @param newPassword New user password
|
||||||
|
*/
|
||||||
|
public void changePassword(String oldPassword, String newPassword)
|
||||||
|
{
|
||||||
|
ParameterCheck.mandatoryString("oldPassword", oldPassword);
|
||||||
|
ParameterCheck.mandatoryString("newPassword", newPassword);
|
||||||
|
|
||||||
|
this.services.getAuthenticationService().updateAuthentication(
|
||||||
|
AuthenticationUtil.getFullyAuthenticatedUser(), oldPassword.toCharArray(), newPassword.toCharArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a password for the given user. Note that only an administrator
|
||||||
|
* can perform this action, otherwise it will be ignored.
|
||||||
|
*
|
||||||
|
* @param userName Username to change password for
|
||||||
|
* @param password Password to set
|
||||||
|
*/
|
||||||
|
public void setPassword(String userName, String password)
|
||||||
|
{
|
||||||
|
ParameterCheck.mandatoryString("userName", userName);
|
||||||
|
ParameterCheck.mandatoryString("password", password);
|
||||||
|
|
||||||
|
if (this.authorityService.hasAdminAuthority())
|
||||||
|
{
|
||||||
|
this.services.getAuthenticationService().setAuthentication(userName, password.toCharArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a Person with the given user name
|
* Create a Person with the given user name
|
||||||
|
Reference in New Issue
Block a user