-
Notifications
You must be signed in to change notification settings - Fork 376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add scratch code support for 2FA; fixes #784 #1334
Conversation
Carson-Tang
commented
Apr 23, 2020
985948a
to
ac33f05
Compare
d17bd47
to
c2cad17
Compare
89b832f
to
b775fa1
Compare
750a291
to
b68ccac
Compare
a1e6a30
to
289c987
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all the hard work 😄
elif self.profile.is_totp_enabled and totp_or_scratch_code: | ||
if pyotp.TOTP(self.profile.totp_key).verify(totp_or_scratch_code, valid_window=self.TOLERANCE): | ||
return | ||
elif totp_or_scratch_code in json.loads(self.profile.scratch_codes): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eventually this should probably be added into totp_or_scratch_code_validators
, converting its contests to a class, but that's for another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This (suggestion) is also just over complicating things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from these remaining small fixes, this PR looks good to me 👍
289c987
to
1e27537
Compare
Suggested changes resolved. |
b68c525
to
8652bd1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise looks good.
8652bd1
to
873506f
Compare
873506f
to
dbab21b
Compare
dbab21b
to
8aa4462
Compare
8aa4462
to
e9d5898
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!