Skip to content

Commit

Permalink
Make the data-deletion script work for accounts with TOTP enabled.
Browse files Browse the repository at this point in the history
  • Loading branch information
rfk committed May 8, 2020
1 parent 516807e commit 20c6984
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions bin/delete_user_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,16 @@ def main(argv):
# TODO: this won't work if the user has enabled two-step auth.
status = s.get_email_status()
if not status["sessionVerified"]:
code = raw_input("Enter verification link or code: ")
if "?" in code:
# They copy-pasted the full URL.
code_url = urlparse.urlparse(code)
code = urlparse.parse_qs(code_url.query)["code"][0]
s.verify_email_code(code)
if s.verificationMethod == "totp-2fa":
code = raw_input("Enter TOTP code: ")
s.totp_verify(code)
else:
code = raw_input("Enter verification link or code received via email: ")
if "?" in code:
# They copy-pasted the full URL.
code_url = urlparse.urlparse(code)
code = urlparse.parse_qs(code_url.query)["code"][0]
s.verify_email_code(code)

# Prepare authentication details for tokenserver.
(_, kB) = s.fetch_keys()
Expand Down

0 comments on commit 20c6984

Please sign in to comment.