Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@CorneAussems
Created July 21, 2017 10:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CorneAussems/08e0269269d5ee19053770b0020e1fc0 to your computer and use it in GitHub Desktop.
Save CorneAussems/08e0269269d5ee19053770b0020e1fc0 to your computer and use it in GitHub Desktop.
Groovy: Liferay Password Reset
import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.util.*;
import com.liferay.portal.service.*;
import com.liferay.portal.service.impl.*;
try {
companyId = companyId = PortalUtil.getDefaultCompanyId();
sc = new com.liferay.portal.service.ServiceContext()
users = UserServiceUtil.getCompanyUsers(companyId, -1,-1 )
println(users.size())
for(i=0;i<users.size();i++){
user = users.get(i)
if(user.getEmailAddress().contains("componence")){
println('User found userId='+user.getUserId()+' screenname:'+user.getScreenName() + ' Lastname:'+user.getLastName())
UserLocalServiceUtil.updatePasswordReset(user.getUserId(),true);
}
}
} catch (Exception e) {
println(e)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment