mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-19 14:09:20 -04:00
Refactor to use shared date comparison function
This means we don’t have to repeatedly do timezone conversions or string to datetime conversions in our business logic.
This commit is contained in:
@@ -16,7 +16,7 @@ from app import user_api_client
|
||||
from app.main import main
|
||||
from app.main.forms import TwoFactorForm
|
||||
from app.models.user import User
|
||||
from app.utils import is_less_than_90_days_ago, redirect_to_sign_in
|
||||
from app.utils import is_less_than_days_ago, redirect_to_sign_in
|
||||
|
||||
|
||||
@main.route('/two-factor-email-sent', methods=['GET'])
|
||||
@@ -70,7 +70,7 @@ def two_factor():
|
||||
form = TwoFactorForm(_check_code)
|
||||
|
||||
if form.validate_on_submit():
|
||||
if is_less_than_90_days_ago(user.email_access_validated_at):
|
||||
if is_less_than_days_ago(user.email_access_validated_at, 90):
|
||||
return log_in_user(user_id)
|
||||
else:
|
||||
user_api_client.send_verify_code(user.id, 'email', None, request.args.get('next'))
|
||||
|
||||
Reference in New Issue
Block a user