We need to reset the passwords of all of our users. Due to the amount of users we have, it would be difficult doing this manually. Is this functionality available out of the box, or is there a best approach to it?
Environment
Liferay DXP 7.3+
Resolution
Unfortunately mass resetting passwords is not something that is available in OOTB Liferay.
This, however, could be achieved via the use of a groovy script. We are listing a proof of concept script below that was drafted for a Liferay DXP 7.3 environment, you may need to adjust it according to your needs.
for (User user : users) { out.println("This user will get a password reset mail: " + user.getUserId()) // UserLocalServiceUtil.sendPasswordByUserId(user.getUserId()); }
Please note that in order to fetch the userIds, we previously used the getCompanyUsers() method, which returns a range of all the users belonging to the company. First this script prints out the userIdsbelonging to the users that will receive a Password Reset Email, so you may adjust the range if needed, then you may uncomment the last line that actually sends out the mass mails.