Foren

Skip change password screen for new & updated users

thumbnail
Kamal Zamer, geändert vor 13 Jahren.

Skip change password screen for new & updated users

New Member Beiträge: 2 Beitrittsdatum: 09.12.10 Neueste Beiträge
I'm creating users programmatically (using UserLocalServiceUtil.addUser not through Liferay's GUI), and when users login in the first time successfully, they're prompted to change their password.

Also I notice that whenever I programmatically update Liferay's user_ table to update a user's password, the user is prompted to change their password again.

I think if I can just disable Liferay's prompt that will solve both problems.

Is there a portal-ext property (or set of properties) that I can set which will stop Liferay from asking users to change their passwords? I would like to avoid changing Liferay source code.

I'm running with Liferay 6.0.5CE and I've tried these properties in portal-ext.properties with no luck:

[indent]# Set this to true to allow the user to choose a password during account creation.
login.create.account.allow.custom.password=false

#
# Set the following to true if users ought to change their passwords on
# first use when an Administrator creates their account. ** From Liferay 4.2 Don't think this works**
passwords.change.on.first.use=false
#[/indent]

I see a thread on how to force newly registered users to change their password upon their first successful login:

Force change via Control Panel

There's also a legacy one related to what I want to accomplish: Legacy way to not have the change password screen

Any direction or input is greatly appreciated.
Thank you!
thumbnail
Minhchau Dang, geändert vor 13 Jahren.

RE: Skip change password screen for new & updated users (Antwort)

Liferay Master Beiträge: 598 Beitrittsdatum: 22.10.07 Neueste Beiträge
Kamal Zamer:
I'm creating users programmatically (using UserLocalServiceUtil.addUser not through Liferay's GUI), and when users login in the first time successfully, they're prompted to change their password.

Are you adverse to adding more code in whatever you're doing programmatically? You can set the 'passwordReset' field on the user object, which is what Liferay checks in order to decide if it should prompt the user to reset their password:

user.setPasswordReset(false);
UserLocalServiceUtil.updateUser(user);
thumbnail
Kamal Zamer, geändert vor 13 Jahren.

RE: Skip change password screen for new & updated users

New Member Beiträge: 2 Beitrittsdatum: 09.12.10 Neueste Beiträge
Hi Minhchau,

It's definitely ok to add more code in the Liferay Utilities that I'm writing - I just didn't want to change the Liferay source itself you know?

This did the trick!

user.setPasswordReset(false);
UserLocalServiceUtil.updateUser(user);


Thank you! I didn't realize 'passwordReset' was what Liferay checked to show the Change Password screen.
thumbnail
Jens Straube, geändert vor 11 Jahren.

RE: Skip change password screen for new & updated users

New Member Beitrag: 1 Beitrittsdatum: 19.04.12 Neueste Beiträge
I had the same problem, and i tried different things, like changing defaultPasswordPolicy or testing all available portlet.properties which I could found on the net ...

I use community version liferay-portal-6.1.0-ce-ga1 and
finally the following method, will avoid the nasty questions at all:

fix:

	
private void avoidLiferayForcePasswordChange(User user) throws SystemException {
		Date date = new Date();
		user.setLastLoginDate(date);
		user.setModifiedDate(date);
		user.setNew(false);
		user.setPasswordModified(true);
		user.setModifiedDate(date);
		user.setPasswordReset(false);
		user.setReminderQueryQuestion("@new@");
		user.setReminderQueryAnswer("@new@");
		UserLocalServiceUtil.updateUser(user);
	}


if you still need the secret question, just comment out the two lines belonging to question ....
thumbnail
Hitoshi Ozawa, geändert vor 11 Jahren.

RE: Skip change password screen for new & updated users

Liferay Legend Beiträge: 7942 Beitrittsdatum: 24.03.10 Neueste Beiträge
Your solution will change more then make user require password change.
Joan Fluvia, geändert vor 10 Jahren.

RE: Skip change password screen for new & updated users

New Member Beiträge: 13 Beitrittsdatum: 06.11.13 Neueste Beiträge
I don't know why but only setting passwordreset(false) was not enough for login automatically without showing any more screens.
Finally using all this sets worked.
I added also setStatus(0)
Kim Zeevaarders, geändert vor 8 Jahren.

RE: Skip change password screen for new & updated users

Junior Member Beiträge: 82 Beitrittsdatum: 07.09.12 Neueste Beiträge
You Sir, are a life saver!

Thx, this did the trick!

Regards,

Kim