[Checkins] SVN: z3c.password/branches/adamg-options/src/z3c/password/principal. accountLocked should not burp when there was no failure

Adam Groszer agroszer at gmail.com
Tue Jun 16 10:33:22 EDT 2009


Log message for revision 101085:
  accountLocked should not burp when there was no failure

Changed:
  U   z3c.password/branches/adamg-options/src/z3c/password/principal.py
  U   z3c.password/branches/adamg-options/src/z3c/password/principal.txt

-=-
Modified: z3c.password/branches/adamg-options/src/z3c/password/principal.py
===================================================================
--- z3c.password/branches/adamg-options/src/z3c/password/principal.py	2009-06-16 13:34:59 UTC (rev 101084)
+++ z3c.password/branches/adamg-options/src/z3c/password/principal.py	2009-06-16 14:33:21 UTC (rev 101085)
@@ -121,7 +121,8 @@
         lockPeriod = self._lockOutPeriod()
         if lockPeriod is not None:
             #check if the user locked himself
-            if self.lastFailedAttempt + lockPeriod > self.now():
+            if (self.lastFailedAttempt is not None
+                and self.lastFailedAttempt + lockPeriod > self.now()):
                 return True
             else:
                 return False

Modified: z3c.password/branches/adamg-options/src/z3c/password/principal.txt
===================================================================
--- z3c.password/branches/adamg-options/src/z3c/password/principal.txt	2009-06-16 13:34:59 UTC (rev 101084)
+++ z3c.password/branches/adamg-options/src/z3c/password/principal.txt	2009-06-16 14:33:21 UTC (rev 101085)
@@ -616,3 +616,12 @@
   >>> user = MyOtherPrincipal('srichter', '123123', u'Stephan Richter')
   >>> user.passwordSetOn
   datetime.datetime(...)
+
+accountLocked should not burp when there was no failure yet:
+
+  >>> user.accountLocked() is None
+  True
+
+  >>> user.lockOutPeriod = 30
+  >>> user.accountLocked()
+  False



More information about the Checkins mailing list