ignore case (optionally) in password check
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@3367 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
d7443e199e
commit
1a47ac9182
1 changed files with 5 additions and 0 deletions
|
@ -54,6 +54,7 @@ class PersonBasedAuthenticator(Persistent, Contained):
|
||||||
implements(IAuthenticatorPlugin, IPersonBasedAuthenticator)
|
implements(IAuthenticatorPlugin, IPersonBasedAuthenticator)
|
||||||
|
|
||||||
passwordKey = 'loops.organize.password'
|
passwordKey = 'loops.organize.password'
|
||||||
|
ignoreCase = True
|
||||||
|
|
||||||
def __init__(self, prefix=''):
|
def __init__(self, prefix=''):
|
||||||
self.prefix = unicode(prefix)
|
self.prefix = unicode(prefix)
|
||||||
|
@ -77,10 +78,14 @@ class PersonBasedAuthenticator(Persistent, Contained):
|
||||||
if login and password:
|
if login and password:
|
||||||
pa = self.getPrincipalAnnotations(
|
pa = self.getPrincipalAnnotations(
|
||||||
getParent(self).prefix + self.prefix + login)
|
getParent(self).prefix + self.prefix + login)
|
||||||
|
if self.ignoreCase:
|
||||||
|
password = password.lower()
|
||||||
return pa.get(self.passwordKey) == password
|
return pa.get(self.passwordKey) == password
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def setPassword(self, login, password):
|
def setPassword(self, login, password):
|
||||||
|
if self.ignoreCase:
|
||||||
|
password = password.lower()
|
||||||
pa = self.getPrincipalAnnotations(
|
pa = self.getPrincipalAnnotations(
|
||||||
getParent(self).prefix + self.prefix + login)
|
getParent(self).prefix + self.prefix + login)
|
||||||
pa[self.passwordKey] = password
|
pa[self.passwordKey] = password
|
||||||
|
|
Loading…
Add table
Reference in a new issue