Commit 23c4796b authored by Ivan Tyagov's avatar Ivan Tyagov

Show number of hours before password is expired.

parent 5f463ae1
...@@ -68,13 +68,15 @@ def _isPasswordExpired():\n ...@@ -68,13 +68,15 @@ def _isPasswordExpired():\n
max_password_lifetime_duration = portal.portal_preferences.getPreferredMaxPasswordLifetimeDuration()\n max_password_lifetime_duration = portal.portal_preferences.getPreferredMaxPasswordLifetimeDuration()\n
password_lifetime_expire_warning_duration = portal.portal_preferences.getPreferredPasswordLifetimeExpireWarningDuration()\n password_lifetime_expire_warning_duration = portal.portal_preferences.getPreferredPasswordLifetimeExpireWarningDuration()\n
last_password_modification_date = context.getLastPasswordModificationDate()\n last_password_modification_date = context.getLastPasswordModificationDate()\n
early_warning = False\n early_warning = 0 #False\n
if last_password_modification_date is not None:\n if last_password_modification_date is not None:\n
expire_date = last_password_modification_date + max_password_lifetime_duration*one_hour \n expire_date = last_password_modification_date + max_password_lifetime_duration*one_hour \n
if password_lifetime_expire_warning_duration not in (0, None,):\n if password_lifetime_expire_warning_duration not in (0, None,):\n
# calculate early warning period\n # calculate early warning period\n
if now > expire_date - password_lifetime_expire_warning_duration*one_hour:\n #context.log( \'%s %s\' %(now, (expire_date - password_lifetime_expire_warning_duration*one_hour)))\n
early_warning = True\n if now > expire_date - password_lifetime_expire_warning_duration*one_hour \\\n
and expire_date > now:\n
early_warning = int(round((expire_date - now))) # return number of hours till expire password moment\n
if expire_date < now:\n if expire_date < now:\n
# password is expired\n # password is expired\n
#context.log(\'expired %s\' %context.getReference())\n #context.log(\'expired %s\' %context.getReference())\n
......
...@@ -75,12 +75,12 @@ ...@@ -75,12 +75,12 @@
</tal:block>\n </tal:block>\n
</tal:block>\n </tal:block>\n
<tal:block tal:condition="not: isAnon"\n <tal:block tal:condition="not: isAnon"\n
tal:define="is_user_account_password_expired_warning_on python:request.get(\'is_user_account_password_expired_warning_on\', False);">\n tal:define="is_user_account_password_expired_warning_on python:request.get(\'is_user_account_password_expired_warning_on\', 0);">\n
\n \n
<!-- Password will expire soon just warn user ? -->\n <!-- Password will expire soon just warn user ? -->\n
<tal:block tal:condition="is_user_account_password_expired_warning_on">\n <tal:block tal:condition="is_user_account_password_expired_warning_on">\n
<tal:block tal:define="came_from python: request.get(\'came_from\') or here.absolute_url();\n <tal:block tal:define="came_from python: request.get(\'came_from\') or here.absolute_url();\n
dummy python: response.redirect(\'%s/ERP5Site_viewNewPersonCredentialUpdateDialog?portal_status_message=%s&amp;cancel_url=%s\' %(came_from, here.Base_translateString(\'Your password will expire soon. You are advised to change it as soon as possible.\'), came_from));" />\n dummy python: response.redirect(\'%s/ERP5Site_viewNewPersonCredentialUpdateDialog?portal_status_message=%s&amp;cancel_url=%s\' %(came_from, here.Base_translateString(\'Your password will expire in %s hours. You are advised to change it as soon as possible.\' %is_user_account_password_expired_warning_on), came_from));" />\n
</tal:block>\n </tal:block>\n
\n \n
<tal:block tal:condition="not: is_user_account_password_expired_warning_on">\n <tal:block tal:condition="not: is_user_account_password_expired_warning_on">\n
......
10 11
\ No newline at end of file \ No newline at end of file
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