restore email sign in code expiry functionality

reverts 789112a31f

however, keeps the changes to the tests as they were an improvement
This commit is contained in:
Leo Hemsted
2020-05-05 12:00:36 +01:00
parent f67625a9fa
commit 2b7e05d4e4
2 changed files with 2 additions and 6 deletions

View File

@@ -190,8 +190,7 @@ def verify_user_code(user_id):
# only relevant from sms
increment_failed_login_count(user_to_verify)
raise InvalidRequest("Code not found", status_code=404)
# TODO: Fix email flow so that clicking link doesn't expire emails
if datetime.utcnow() > code.expiry_datetime or (code.code_used and data['code_type'] != 'email'):
if datetime.utcnow() > code.expiry_datetime or code.code_used:
# sms and email
increment_failed_login_count(user_to_verify)
raise InvalidRequest("Code has expired", status_code=400)