Commit 57dba435 authored by Ivan Tyagov's avatar Ivan Tyagov

Make sure code will fall back if implementation scripts are not

provided.
Fallback means that no authentication policy will be applied if former
is true.
parent df72c047
...@@ -45,7 +45,8 @@ class LoginAccountProviderMixin: ...@@ -45,7 +45,8 @@ class LoginAccountProviderMixin:
Notify an authentication failure. Notify an authentication failure.
""" """
method = self._getTypeBasedMethod('notifyLoginFailure') method = self._getTypeBasedMethod('notifyLoginFailure')
return method(**kw) if method is not None:
return method(**kw)
security.declareProtected(Permissions.SetOwnPassword, 'notifyPasswordExpire') security.declareProtected(Permissions.SetOwnPassword, 'notifyPasswordExpire')
def notifyPasswordExpire(self, **kw): def notifyPasswordExpire(self, **kw):
...@@ -53,7 +54,8 @@ class LoginAccountProviderMixin: ...@@ -53,7 +54,8 @@ class LoginAccountProviderMixin:
Notify a password expire event. Notify a password expire event.
""" """
method = self._getTypeBasedMethod('notifyPasswordExpire') method = self._getTypeBasedMethod('notifyPasswordExpire')
return method(**kw) if method is not None:
return method(**kw)
security.declareProtected(Permissions.SetOwnPassword, 'isLoginBlocked') security.declareProtected(Permissions.SetOwnPassword, 'isLoginBlocked')
def isLoginBlocked(self, **kw): def isLoginBlocked(self, **kw):
...@@ -61,7 +63,9 @@ class LoginAccountProviderMixin: ...@@ -61,7 +63,9 @@ class LoginAccountProviderMixin:
Is this login blocked? Is this login blocked?
""" """
method = self._getTypeBasedMethod('isLoginBlocked') method = self._getTypeBasedMethod('isLoginBlocked')
return method(**kw) if method is not None:
return method(**kw)
return False
security.declareProtected(Permissions.SetOwnPassword, 'isPasswordExpired') security.declareProtected(Permissions.SetOwnPassword, 'isPasswordExpired')
def isPasswordExpired(self, **kw): def isPasswordExpired(self, **kw):
...@@ -69,7 +73,9 @@ class LoginAccountProviderMixin: ...@@ -69,7 +73,9 @@ class LoginAccountProviderMixin:
Is password expired? Is password expired?
""" """
method = self._getTypeBasedMethod('isPasswordExpired') method = self._getTypeBasedMethod('isPasswordExpired')
return method(**kw) if method is not None:
return method(**kw)
return False
security.declareProtected(Permissions.SetOwnPassword, 'isPasswordValid') security.declareProtected(Permissions.SetOwnPassword, 'isPasswordValid')
def isPasswordValid(self, password, **kw): def isPasswordValid(self, password, **kw):
...@@ -77,7 +83,9 @@ class LoginAccountProviderMixin: ...@@ -77,7 +83,9 @@ class LoginAccountProviderMixin:
Is password valid? Is password valid?
""" """
method = self._getTypeBasedMethod('isPasswordValid') method = self._getTypeBasedMethod('isPasswordValid')
return method(password, **kw) if method is not None:
return method(password, **kw)
return True
security.declareProtected(Permissions.SetOwnPassword, 'isPasswordAlreadyUsed') security.declareProtected(Permissions.SetOwnPassword, 'isPasswordAlreadyUsed')
def isPasswordAlreadyUsed(self, password): def isPasswordAlreadyUsed(self, password):
......
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