mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-19 05:59:44 -04:00
109898688: All codes are valid until one code is used, then they are all marked used.
Fixed the is_active() method on the Users model, if the user was pending they would come back as active, allowing a user to sign in before being active. There is still a problem with the validate_sms_code and validate_email_code method.
This commit is contained in:
@@ -51,13 +51,12 @@ def test_returns_errors_when_code_contains_letters(notifications_admin, notifica
|
||||
def test_should_return_errors_when_code_is_expired(notifications_admin, notifications_admin_db, notify_db_session):
|
||||
with notifications_admin.test_request_context(method='POST',
|
||||
data={'sms_code': '23456'}) as req:
|
||||
user = create_test_user()
|
||||
user = create_test_user('active')
|
||||
req.session['user_id'] = user.id
|
||||
verify_codes_dao.add_code_with_expiry(user_id=user.id,
|
||||
code='23456',
|
||||
code_type='sms',
|
||||
expiry=datetime.now() + timedelta(hours=-2))
|
||||
req.session['user_id'] = user.id
|
||||
form = TwoFactorForm(req.request.form)
|
||||
assert form.validate() is False
|
||||
errors = form.errors
|
||||
@@ -66,6 +65,6 @@ def test_should_return_errors_when_code_is_expired(notifications_admin, notifica
|
||||
|
||||
|
||||
def set_up_test_data():
|
||||
user = create_test_user()
|
||||
user = create_test_user('active')
|
||||
verify_codes_dao.add_code(user_id=user.id, code='12345', code_type='sms')
|
||||
return user
|
||||
|
||||
Reference in New Issue
Block a user