Commit 943cda95 authored by Jérome Perrin's avatar Jérome Perrin

authentication_event: fix password expiration

Before this change, password event were only recorded when
preferred_number_of_last_password_to_check was set.

We also need to record password events to check for password lifetime,
so also record password events when preferred_max_lifetime_duration is
is set (also when set to 0h, but this only makes sense in tests).

testAuthenticationPolicy was not showing this problem, because tests were not properly
isolated and test_02_PasswordHistory was enabling
preferred_number_of_last_password_to_check for all other tests.
parent f1c335aa
......@@ -2,9 +2,9 @@ login = state_change['object']
portal = login.getPortalObject()
# check preferences and save only if set
number_of_last_password_to_check = portal.portal_preferences.getPreferredNumberOfLastPasswordToCheck()
if number_of_last_password_to_check is not None and number_of_last_password_to_check:
if portal.portal_preferences.getPreferredNumberOfLastPasswordToCheck() or \
portal.portal_preferences.getPreferredMaxPasswordLifetimeDuration() is not None:
# save password and modification date
current_password = login.getPassword()
if current_password is not None:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment