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:
helmutm 2009-05-02 20:45:55 +00:00
parent d7443e199e
commit 1a47ac9182

View file

@ -54,6 +54,7 @@ class PersonBasedAuthenticator(Persistent, Contained):
implements(IAuthenticatorPlugin, IPersonBasedAuthenticator)
passwordKey = 'loops.organize.password'
ignoreCase = True
def __init__(self, prefix=''):
self.prefix = unicode(prefix)
@ -77,10 +78,14 @@ class PersonBasedAuthenticator(Persistent, Contained):
if login and password:
pa = self.getPrincipalAnnotations(
getParent(self).prefix + self.prefix + login)
if self.ignoreCase:
password = password.lower()
return pa.get(self.passwordKey) == password
return None
def setPassword(self, login, password):
if self.ignoreCase:
password = password.lower()
pa = self.getPrincipalAnnotations(
getParent(self).prefix + self.prefix + login)
pa[self.passwordKey] = password