Skip to content

Commit

Permalink
Check none type scratch codes (DMOJ#1459)
Browse files Browse the repository at this point in the history
  • Loading branch information
Carson-Tang authored and outloudvi committed Sep 28, 2020
1 parent bc4c30d commit c42ab59
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion judge/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def clean(self):
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):
elif self.profile.scratch_codes and totp_or_scratch_code in json.loads(self.profile.scratch_codes):
scratch_codes = json.loads(self.profile.scratch_codes)
scratch_codes.remove(totp_or_scratch_code)
self.profile.scratch_codes = json.dumps(scratch_codes)
Expand Down

0 comments on commit c42ab59

Please sign in to comment.