Merge pull request #212 from mozilla-services/delete-data-with-totp

Make the data-deletion script work for accounts with TOTP enabled.
This commit is contained in:
Ryan Kelly 2020-07-03 14:37:43 +10:00 committed by GitHub
commit e1aab54cbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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()