mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-05 02:41:14 -05:00
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:
@@ -190,8 +190,7 @@ def verify_user_code(user_id):
|
|||||||
# only relevant from sms
|
# only relevant from sms
|
||||||
increment_failed_login_count(user_to_verify)
|
increment_failed_login_count(user_to_verify)
|
||||||
raise InvalidRequest("Code not found", status_code=404)
|
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:
|
||||||
if datetime.utcnow() > code.expiry_datetime or (code.code_used and data['code_type'] != 'email'):
|
|
||||||
# sms and email
|
# sms and email
|
||||||
increment_failed_login_count(user_to_verify)
|
increment_failed_login_count(user_to_verify)
|
||||||
raise InvalidRequest("Code has expired", status_code=400)
|
raise InvalidRequest("Code has expired", status_code=400)
|
||||||
|
|||||||
@@ -453,10 +453,7 @@ def test_user_verify_email_code(admin_request, sample_user, auth_type):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('code_type', [
|
@pytest.mark.parametrize('code_type', [
|
||||||
pytest.param(
|
|
||||||
EMAIL_TYPE,
|
EMAIL_TYPE,
|
||||||
marks=pytest.mark.xfail(raises=AssertionError, reason='Email code expiry disabled'),
|
|
||||||
),
|
|
||||||
SMS_TYPE
|
SMS_TYPE
|
||||||
])
|
])
|
||||||
@freeze_time('2016-01-01T12:00:00')
|
@freeze_time('2016-01-01T12:00:00')
|
||||||
|
|||||||
Reference in New Issue
Block a user