Permalink
Browse files

set default time for accept_totp, fixes #5

Thanks to jontrov@github for the patch and reporting the issue.
  • Loading branch information...
1 parent 26df82e commit 6118997aa62512bbe7ffba2f1743385624447261 @bdauvergne committed Oct 4, 2012
Showing with 2 additions and 0 deletions.
  1. +2 −0 oath/totp.py
View
2 oath/totp.py
@@ -120,6 +120,8 @@ def accept_totp(key, response, format='dec6', period=30, t=None,
reliable source of time like an NTP server.
:rtype: a two element tuple
'''
+ if t is None:
+ t = int(time.time())
for i in range(max(-divmod(t, period)[0],-backward_drift),forward_drift+1):
d = (drift+i) * period
if totp(key, format=format, period=period, hash=hash, t=t+d) == str(response):

0 comments on commit 6118997

Please sign in to comment.