Commit d6186232 authored by Yusei Tahara's avatar Yusei Tahara

erp5_authentication_policy: Add a log message if preference is missing.

parent 88ee0cb9
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
""" """
from DateTime import DateTime from DateTime import DateTime
from Products.ZSQLCatalog.SQLCatalog import Query from Products.ZSQLCatalog.SQLCatalog import Query
from erp5.component.module.Log import log
request = context.REQUEST request = context.REQUEST
portal = context.getPortalObject() portal = context.getPortalObject()
...@@ -17,6 +18,13 @@ one_second = 1/24.0/60.0/60.0 ...@@ -17,6 +18,13 @@ one_second = 1/24.0/60.0/60.0
check_duration = portal_preferences.getPreferredAuthenticationFailureCheckDuration() check_duration = portal_preferences.getPreferredAuthenticationFailureCheckDuration()
block_duration = portal_preferences.getPreferredAuthenticationFailureBlockDuration() block_duration = portal_preferences.getPreferredAuthenticationFailureBlockDuration()
max_authentication_failures = portal_preferences.getPreferredMaxAuthenticationFailure() max_authentication_failures = portal_preferences.getPreferredMaxAuthenticationFailure()
if None in (check_duration,
block_duration,
max_authentication_failures):
log('Login block is not working because authentication policy in system preference is not set properly.')
return 0
check_time = now - check_duration*one_second check_time = now - check_duration*one_second
# some failures might be still unindexed # some failures might be still unindexed
......
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