Last active
September 13, 2020 06:08
-
-
Save beeTechMantra/d03f5a7603f3c96aa5b5e810a83bd57e to your computer and use it in GitHub Desktop.
Liferay update/set password using groovy script/Programmatically
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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