Skip to content

Instantly share code, notes, and snippets.

@beeTechMantra
Last active September 13, 2020 06:08
Show Gist options
  • Save beeTechMantra/d03f5a7603f3c96aa5b5e810a83bd57e to your computer and use it in GitHub Desktop.
Save beeTechMantra/d03f5a7603f3c96aa5b5e810a83bd57e to your computer and use it in GitHub Desktop.
Liferay update/set password using groovy script/Programmatically
import com.liferay.portal.kernel.model.User
import com.liferay.portal.kernel.service.UserLocalServiceUtil
import java.util.Date
try{
//123456 - here you have to change userID which you have to change the password
User user = UserLocalServiceUtil.getUser(123456);
// here you have to set the password
user.setPassword("BeeTechMantra");
user.setPasswordReset(true);
user.setPasswordEncrypted(true);
user.setPasswordModifiedDate(new Date());
UserLocalServiceUtil.updateUser(user);
}catch(e) {
out.println(e);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment