Migrate User Passwords from Liferay 4.4.2 to Liferay 6.0.6
-
26-10-2019 - |
Pergunta
Have some users in Liferay 4.4.2 that are currently active, all having valid passwords. Have the same users in Liferay 6.0.6, all of them added with a default password.
Can you suggest a way where I can migrate the passwords of users from Liferay 4.4.2 to Liferay 6.0.6?
Tried copying the passwords directy through DB in the users table (I know its not adviced, but I had to start somewhere). Didn't work out.
The encryption algorithm used in both the versions is MD5. Is there a difference in the encoding digest? There is no Digest Column in Liferay 4.4.2, but can see one in Liferay 6.0.6
How can I migrate the passwords?
Solução
Currently using Forgot Password functionality to intimate the users to change their passwords which I know is hectic. This is how I did it:
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
Company company = themeDisplay.getCompany();
ServiceContext serviceContext = ServiceContextFactory.getInstance(PortalUtil.getHttpServletRequest(actionRequest));
//Replace the variables with corresponding values
UserLocalServiceUtil.sendPassword(companyId, emailAddress, remoteAddr, remoteHost, userAgent, fromName, fromAddress, subject, body, serviceContext);
Any better solutions are welcome.