core-geonetwork icon indicating copy to clipboard operation
core-geonetwork copied to clipboard

Reset password doesn't work for legacy users (2.x versions) that require to

Open josegar74 opened this issue 7 years ago • 2 comments

Legacy users have in the security field in the database the value update_hash_required as in previous versions of GeoNetwork the encoder algorithm was different. So they have to reset the password.

When reseting the password from the Admin UI, it works updating the password and removing previous value:

https://github.com/geonetwork/core-geonetwork/blob/3.4.x/core/src/main/java/org/fao/geonet/util/PasswordUtil.java#L220

user.getSecurity().getSecurityNotifications().remove(UserSecurityNotification.UPDATE_HASH_REQUIRED);

But not from the Forgot password that uses PasswordApi and doesn't remove that attribute, so the user can't login:

https://github.com/geonetwork/core-geonetwork/blob/3.4.x/services/src/main/java/org/fao/geonet/api/users/PasswordApi.java#L136

user.getSecurity().setPassword(PasswordUtil.encode(context, passwordAndChangeKey.getPassword()));
userRepository.save(user);

josegar74 avatar Dec 19 '17 11:12 josegar74

Moving forward as it is not a blocking issue.

Delawen avatar Jun 27 '18 08:06 Delawen

This ticket was not handled during GN3 development. Should probably be considered stale.

jodygarnett avatar Feb 07 '24 17:02 jodygarnett