Extract login utils out of two_factor view

This better reflects how the code is reused in other views and is
not specific to two factor actions. We have a pattern of testing
utility functionality for each view (as opposed to testing the util
+ the view calls the util), so I'm leaving the tests as-is.
This commit is contained in:
Ben Thorner
2021-06-14 11:15:57 +01:00
parent 3250f2b3ed
commit bf2e6802bf
4 changed files with 45 additions and 40 deletions

View File

@@ -6,12 +6,11 @@ from flask_login import current_user
from werkzeug.exceptions import Forbidden
from app.main import main
from app.main.views.two_factor import log_in_user
from app.models.user import User
from app.models.webauthn_credential import RegistrationError, WebAuthnCredential
from app.notify_client.user_api_client import user_api_client
from app.utils import is_less_than_days_ago
from app.utils.login import redirect_to_sign_in
from app.utils.login import log_in_user, redirect_to_sign_in
from app.utils.user import user_is_platform_admin