diff --git a/.djlintrc b/.djlintrc new file mode 100644 index 00000000..79a88ccd --- /dev/null +++ b/.djlintrc @@ -0,0 +1,11 @@ +{ + "ignore": "H017,H025,H030,H031", + "extension": "html", + "indent": "2", + "profile": "jinja", + "format_attribute_template_tags": "true", + "max_line_length": 120, + "max_attribute_length": 240, + "blank_line_after_tag": "from,endmacro", + "blank_line_before_tag": "block,extends" +} diff --git a/flask_security/templates/security/_macros.html b/flask_security/templates/security/_macros.html index d01f2654..1f4fae48 100644 --- a/flask_security/templates/security/_macros.html +++ b/flask_security/templates/security/_macros.html @@ -3,9 +3,7 @@ {{ field.label }} {{ field(**kwargs)|safe }} {% if field.errors %} {% endif %} @@ -19,9 +17,7 @@
{% if field and field.errors %} {% endif %}
@@ -31,11 +27,9 @@ {% macro render_form_errors(form) %} {% if form.form_errors %}
- +
{% endif %} {% endmacro %} diff --git a/flask_security/templates/security/_menu.html b/flask_security/templates/security/_menu.html index b5538e02..819f66db 100644 --- a/flask_security/templates/security/_menu.html +++ b/flask_security/templates/security/_menu.html @@ -1,38 +1,58 @@ {% if security.registerable or security.recoverable or security.confirmable or security.unified_signin or security.two_factor or security.webauthn %} -
-

{{ _fsdomain('Menu') }}

- +
+

{{ _fsdomain('Menu') }}

+ {% endif %} diff --git a/flask_security/templates/security/_messages.html b/flask_security/templates/security/_messages.html index 2052ce5b..286c1dcb 100644 --- a/flask_security/templates/security/_messages.html +++ b/flask_security/templates/security/_messages.html @@ -1,9 +1,7 @@ {%- with messages = get_flashed_messages(with_categories=true) -%} {% if messages %} {% endif %} {%- endwith %} diff --git a/flask_security/templates/security/base.html b/flask_security/templates/security/base.html index 4469292a..f0fcdd85 100644 --- a/flask_security/templates/security/base.html +++ b/flask_security/templates/security/base.html @@ -7,7 +7,7 @@ {% block title %}{{ title|default }}{% endblock title %} {%- block metas %} - + {%- endblock metas %} {%- block head_scripts %} diff --git a/flask_security/templates/security/change_password.html b/flask_security/templates/security/change_password.html index 2624e55e..a34632cb 100644 --- a/flask_security/templates/security/change_password.html +++ b/flask_security/templates/security/change_password.html @@ -2,17 +2,17 @@ {% from "security/_macros.html" import render_field_with_errors, render_field %} {% block content %} -{% include "security/_messages.html" %} -

{{ _fsdomain('Change password') }}

-
- {{ change_password_form.hidden_tag() }} - {% if active_password %} - {{ render_field_with_errors(change_password_form.password) }} - {% else %} -

{{ _fsdomain('You do not currently have a password - this will add one.') }}

- {% endif %} - {{ render_field_with_errors(change_password_form.new_password) }} - {{ render_field_with_errors(change_password_form.new_password_confirm) }} - {{ render_field(change_password_form.submit) }} -
-{% endblock %} + {% include "security/_messages.html" %} +

{{ _fsdomain('Change password') }}

+
+ {{ change_password_form.hidden_tag() }} + {% if active_password %} + {{ render_field_with_errors(change_password_form.password) }} + {% else %} +

{{ _fsdomain('You do not currently have a password - this will add one.') }}

+ {% endif %} + {{ render_field_with_errors(change_password_form.new_password) }} + {{ render_field_with_errors(change_password_form.new_password_confirm) }} + {{ render_field(change_password_form.submit) }} +
+{% endblock content %} diff --git a/flask_security/templates/security/email/change_notice.html b/flask_security/templates/security/email/change_notice.html index 1bb2445c..4f9af730 100644 --- a/flask_security/templates/security/email/change_notice.html +++ b/flask_security/templates/security/email/change_notice.html @@ -1,4 +1,6 @@

{{ _fsdomain('Your password has been changed.') }}

{% if security.recoverable %} -

{{ _fsdomain('If you did not change your password,') }} {{ _fsdomain('click here to reset it') }}.

+

+ {{ _fsdomain('If you did not change your password,') }} {{ _fsdomain('click here to reset it') }}. +

{% endif %} diff --git a/flask_security/templates/security/email/confirmation_instructions.html b/flask_security/templates/security/email/confirmation_instructions.html index 233127e1..3b0ff63b 100644 --- a/flask_security/templates/security/email/confirmation_instructions.html +++ b/flask_security/templates/security/email/confirmation_instructions.html @@ -6,5 +6,6 @@ security - the Flask-Security configuration #}

{{ _fsdomain('Please confirm your email through the link below:') }}

- -

{{ _fsdomain('Confirm my account') }}

+

+ {{ _fsdomain('Confirm my account') }} +

diff --git a/flask_security/templates/security/email/login_instructions.html b/flask_security/templates/security/email/login_instructions.html index aeac9905..ab156dde 100644 --- a/flask_security/templates/security/email/login_instructions.html +++ b/flask_security/templates/security/email/login_instructions.html @@ -1,5 +1,5 @@

{{ _fsdomain('Welcome %(email)s!', email=user.email) }}

-

{{ _fsdomain('You can log into your account through the link below:') }}

- -

{{ _fsdomain('Login now') }}

+

+ {{ _fsdomain('Login now') }} +

diff --git a/flask_security/templates/security/email/reset_instructions.html b/flask_security/templates/security/email/reset_instructions.html index 09f41338..5daab327 100644 --- a/flask_security/templates/security/email/reset_instructions.html +++ b/flask_security/templates/security/email/reset_instructions.html @@ -5,4 +5,6 @@ user - the entire user model object security - the Flask-Security configuration #} -

{{ _fsdomain('Click here to reset your password') }}

+

+ {{ _fsdomain('Click here to reset your password') }} +

diff --git a/flask_security/templates/security/email/two_factor_instructions.html b/flask_security/templates/security/email/two_factor_instructions.html index ede54c10..4518d7ab 100644 --- a/flask_security/templates/security/email/two_factor_instructions.html +++ b/flask_security/templates/security/email/two_factor_instructions.html @@ -1,3 +1,2 @@

{{ _fsdomain("Welcome") }} {{ username }}!

-

{{ _fsdomain("You can log into your account using the following code:") }} {{ token }}

diff --git a/flask_security/templates/security/email/two_factor_rescue.html b/flask_security/templates/security/email/two_factor_rescue.html index 4859e660..e51523c1 100644 --- a/flask_security/templates/security/email/two_factor_rescue.html +++ b/flask_security/templates/security/email/two_factor_rescue.html @@ -1 +1 @@ -

{{ user.email }} {{ _fsdomain("can not access mail account") }}

+

{{ user.email }} {{ _fsdomain("can not access mail account") }}

diff --git a/flask_security/templates/security/email/us_instructions.html b/flask_security/templates/security/email/us_instructions.html index 646f6c1f..1fb3e690 100644 --- a/flask_security/templates/security/email/us_instructions.html +++ b/flask_security/templates/security/email/us_instructions.html @@ -7,11 +7,10 @@ security - the Flask-Security configuration #}

{{ _fsdomain("Welcome") }} {{ username }}!

-

{{ _fsdomain("You can sign into your account using the following code:") }} {{ token }}

- {% if login_link %}

{{ _fsdomain("Or use the link below:") }}

- -

{{ _fsdomain("Sign In") }}

-{% endif %} +

+ {{ _fsdomain("Sign In") }} +

+{% endif %} diff --git a/flask_security/templates/security/email/welcome.html b/flask_security/templates/security/email/welcome.html index c0bc3751..b48ac66e 100644 --- a/flask_security/templates/security/email/welcome.html +++ b/flask_security/templates/security/email/welcome.html @@ -6,9 +6,9 @@ security - the Flask-Security configuration #}

{{ _fsdomain('Welcome %(email)s!', email=user.email) }}

- {% if security.confirmable %} -

{{ _fsdomain('You can confirm your email through the link below:') }}

- -

{{ _fsdomain('Confirm my account') }}

+

{{ _fsdomain('You can confirm your email through the link below:') }}

+

+ {{ _fsdomain('Confirm my account') }} +

{% endif %} diff --git a/flask_security/templates/security/email/welcome_existing.html b/flask_security/templates/security/email/welcome_existing.html index a41bbbf9..b3fd1d07 100644 --- a/flask_security/templates/security/email/welcome_existing.html +++ b/flask_security/templates/security/email/welcome_existing.html @@ -9,15 +9,15 @@ enumeration. #}
{{ _fsdomain('Hello %(email)s!', email=user.email) }}
-
{{ _fsdomain('Someone (you?) tried to register this email - which is already in our system.') }}
- {% if user.username %} -
{{ _fsdomain('This account also has the following username associated with it: %(username)s.', username=user.username) }}
+
+ {{ _fsdomain('This account also has the following username associated with it: %(username)s.', username=user.username) }} +
{% endif %} - {% if recovery_link %} -
{{ _fsdomain('If you forgot your password you can reset it') }} - {{ _fsdomain(' here.') }} +
+ {{ _fsdomain('If you forgot your password you can reset it') }} + {{ _fsdomain(' here.') }}
{% endif %} diff --git a/flask_security/templates/security/email/welcome_existing_username.html b/flask_security/templates/security/email/welcome_existing_username.html index 82126f86..e7b88211 100644 --- a/flask_security/templates/security/email/welcome_existing_username.html +++ b/flask_security/templates/security/email/welcome_existing_username.html @@ -9,8 +9,7 @@ for username enumeration. #}
{{ _fsdomain('Hello %(email)s!', email=email) }}
- -
{{ _fsdomain('You attempted to register with a username "%(username)s" that is already associated with another account.', - username=username) }}
- +
+ {{ _fsdomain('You attempted to register with a username "%(username)s" that is already associated with another account.', username=username) }} +
{{ _fsdomain('Please restart the registration process with a different username.') }}
diff --git a/flask_security/templates/security/forgot_password.html b/flask_security/templates/security/forgot_password.html index 8e897086..1b07a09d 100644 --- a/flask_security/templates/security/forgot_password.html +++ b/flask_security/templates/security/forgot_password.html @@ -2,12 +2,12 @@ {% from "security/_macros.html" import render_field_with_errors, render_field %} {% block content %} -{% include "security/_messages.html" %} -

{{ _fsdomain('Send password reset instructions') }}

-
- {{ forgot_password_form.hidden_tag() }} - {{ render_field_with_errors(forgot_password_form.email) }} - {{ render_field(forgot_password_form.submit) }} -
-{% include "security/_menu.html" %} -{% endblock %} + {% include "security/_messages.html" %} +

{{ _fsdomain('Send password reset instructions') }}

+
+ {{ forgot_password_form.hidden_tag() }} + {{ render_field_with_errors(forgot_password_form.email) }} + {{ render_field(forgot_password_form.submit) }} +
+ {% include "security/_menu.html" %} +{% endblock content %} diff --git a/flask_security/templates/security/login_user.html b/flask_security/templates/security/login_user.html index d1bc297b..0991a68b 100644 --- a/flask_security/templates/security/login_user.html +++ b/flask_security/templates/security/login_user.html @@ -2,22 +2,17 @@ {% from "security/_macros.html" import render_field_with_errors, render_field, render_field_errors, render_form_errors, prop_next %} {% block content %} -{% include "security/_messages.html" %} -

{{ _fsdomain('Login') }}

-
+ {% include "security/_messages.html" %} +

{{ _fsdomain('Login') }}

+ {{ login_user_form.hidden_tag() }} {{ render_form_errors(login_user_form) }} - {% if "email" in identity_attributes %} - {{ render_field_with_errors(login_user_form.email) }} - {% endif %} + {% if "email" in identity_attributes %}{{ render_field_with_errors(login_user_form.email) }}{% endif %} {% if login_user_form.username and "username" in identity_attributes %} - {% if "email" in identity_attributes %} -

{{ _fsdomain("or") }}

- {% endif %} + {% if "email" in identity_attributes %}

{{ _fsdomain("or") }}

{% endif %} {{ render_field_with_errors(login_user_form.username) }} {% endif %} -
- {{ render_field_with_errors(login_user_form.password) }}
+
{{ render_field_with_errors(login_user_form.password) }}
{{ render_field_with_errors(login_user_form.remember) }} {{ render_field_errors(login_user_form.csrf_token) }} {{ render_field(login_user_form.submit) }} @@ -26,9 +21,8 @@

{{ _fsdomain("or") }}


{{ _fsdomain("Use WebAuthn to Sign In") }}

- - + +
{% endif %} @@ -37,12 +31,11 @@

{{ _fsdomain("Use WebAuthn to Sign In") }}

{{ _fsdomain("Use Social Oauth to Sign In") }}

{% for provider in security.oauthglue.provider_names %}
-
- + +
{% endfor %} {% endif %} -{% include "security/_menu.html" %} -{% endblock %} + {% include "security/_menu.html" %} +{% endblock content %} diff --git a/flask_security/templates/security/mf_recovery.html b/flask_security/templates/security/mf_recovery.html index 699f883a..953a904c 100644 --- a/flask_security/templates/security/mf_recovery.html +++ b/flask_security/templates/security/mf_recovery.html @@ -2,12 +2,11 @@ {% from "security/_macros.html" import render_field_with_errors, render_field %} {% block content %} - {% include "security/_messages.html" %} -

{{ _fsdomain("Enter Recovery Code") }}

-
- {{ mf_recovery_form.hidden_tag() }} - {{ render_field_with_errors(mf_recovery_form.code) }} - {{ render_field(mf_recovery_form.submit) }} -
-{% endblock %} + {% include "security/_messages.html" %} +

{{ _fsdomain("Enter Recovery Code") }}

+
+ {{ mf_recovery_form.hidden_tag() }} + {{ render_field_with_errors(mf_recovery_form.code) }} + {{ render_field(mf_recovery_form.submit) }} +
+{% endblock content %} diff --git a/flask_security/templates/security/mf_recovery_codes.html b/flask_security/templates/security/mf_recovery_codes.html index 988c0c32..38853ad7 100644 --- a/flask_security/templates/security/mf_recovery_codes.html +++ b/flask_security/templates/security/mf_recovery_codes.html @@ -2,31 +2,26 @@ {% from "security/_macros.html" import render_field_with_errors, render_field, render_field_errors %} {% block content %} - {% include "security/_messages.html" %} -

{{ _fsdomain("Recovery Codes") }}

- {% if recovery_codes %} - -
+ {% include "security/_messages.html" %} +

{{ _fsdomain("Recovery Codes") }}

+ {% if recovery_codes %} + +
{{ _fsdomain("Be sure to copy these and store in a safe place. Each code can be used only once.") }} -
- {% else %} -
- - {{ render_field_with_errors(mf_recovery_codes_form.show_codes) }} -
- {% endif %} -
-

{{ _fsdomain("Generate new Recovery Codes") }}

-
- {{ mf_recovery_codes_form.hidden_tag() }} - {{ render_field_errors(mf_recovery_codes_form.csrf_token) }} - {{ render_field(mf_recovery_codes_form.generate_new_codes) }} +
+ {% else %} + + {{ render_field_with_errors(mf_recovery_codes_form.show_codes) }} - {% include "security/_menu.html" %} -{% endblock %} + {% endif %} +
+

{{ _fsdomain("Generate new Recovery Codes") }}

+
+ {{ mf_recovery_codes_form.hidden_tag() }} + {{ render_field_errors(mf_recovery_codes_form.csrf_token) }} + {{ render_field(mf_recovery_codes_form.generate_new_codes) }} +
+ {% include "security/_menu.html" %} +{% endblock content %} diff --git a/flask_security/templates/security/register_user.html b/flask_security/templates/security/register_user.html index 1650b3a3..6bee960b 100644 --- a/flask_security/templates/security/register_user.html +++ b/flask_security/templates/security/register_user.html @@ -2,20 +2,18 @@ {% from "security/_macros.html" import render_field_with_errors, render_field, render_form_errors %} {% block content %} -{% include "security/_messages.html" %} -

{{ _fsdomain('Register') }}

-
- {{ register_user_form.hidden_tag() }} - {{ render_form_errors(register_user_form) }} - {{ render_field_with_errors(register_user_form.email) }} - {% if security.username_enable %} - {{ render_field_with_errors(register_user_form.username) }} - {% endif %} - {{ render_field_with_errors(register_user_form.password) }} - {% if register_user_form.password_confirm %} - {{ render_field_with_errors(register_user_form.password_confirm) }} - {% endif %} - {{ render_field(register_user_form.submit) }} -
-{% include "security/_menu.html" %} -{% endblock %} + {% include "security/_messages.html" %} +

{{ _fsdomain('Register') }}

+
+ {{ register_user_form.hidden_tag() }} + {{ render_form_errors(register_user_form) }} + {{ render_field_with_errors(register_user_form.email) }} + {% if security.username_enable %}{{ render_field_with_errors(register_user_form.username) }}{% endif %} + {{ render_field_with_errors(register_user_form.password) }} + {% if register_user_form.password_confirm %} + {{ render_field_with_errors(register_user_form.password_confirm) }} + {% endif %} + {{ render_field(register_user_form.submit) }} +
+ {% include "security/_menu.html" %} +{% endblock content %} diff --git a/flask_security/templates/security/reset_password.html b/flask_security/templates/security/reset_password.html index ab074d1a..1a9b593e 100644 --- a/flask_security/templates/security/reset_password.html +++ b/flask_security/templates/security/reset_password.html @@ -2,13 +2,13 @@ {% from "security/_macros.html" import render_field_with_errors, render_field %} {% block content %} -{% include "security/_messages.html" %} -

{{ _fsdomain('Reset password') }}

-
- {{ reset_password_form.hidden_tag() }} - {{ render_field_with_errors(reset_password_form.password) }} - {{ render_field_with_errors(reset_password_form.password_confirm) }} - {{ render_field(reset_password_form.submit) }} -
-{% include "security/_menu.html" %} -{% endblock %} + {% include "security/_messages.html" %} +

{{ _fsdomain('Reset password') }}

+
+ {{ reset_password_form.hidden_tag() }} + {{ render_field_with_errors(reset_password_form.password) }} + {{ render_field_with_errors(reset_password_form.password_confirm) }} + {{ render_field(reset_password_form.submit) }} +
+ {% include "security/_menu.html" %} +{% endblock content %} diff --git a/flask_security/templates/security/send_confirmation.html b/flask_security/templates/security/send_confirmation.html index 3ee1de1d..82e88e41 100644 --- a/flask_security/templates/security/send_confirmation.html +++ b/flask_security/templates/security/send_confirmation.html @@ -2,12 +2,12 @@ {% from "security/_macros.html" import render_field_with_errors, render_field %} {% block content %} -{% include "security/_messages.html" %} -

{{ _fsdomain('Resend confirmation instructions') }}

-
- {{ send_confirmation_form.hidden_tag() }} - {{ render_field_with_errors(send_confirmation_form.email) }} - {{ render_field(send_confirmation_form.submit) }} -
-{% include "security/_menu.html" %} -{% endblock %} + {% include "security/_messages.html" %} +

{{ _fsdomain('Resend confirmation instructions') }}

+
+ {{ send_confirmation_form.hidden_tag() }} + {{ render_field_with_errors(send_confirmation_form.email) }} + {{ render_field(send_confirmation_form.submit) }} +
+ {% include "security/_menu.html" %} +{% endblock content %} diff --git a/flask_security/templates/security/send_login.html b/flask_security/templates/security/send_login.html index 4e5a25d1..bafccb38 100644 --- a/flask_security/templates/security/send_login.html +++ b/flask_security/templates/security/send_login.html @@ -2,12 +2,12 @@ {% from "security/_macros.html" import render_field_with_errors, render_field %} {% block content %} -{% include "security/_messages.html" %} -

{{ _fsdomain('Login') }}

-
- {{ send_login_form.hidden_tag() }} - {{ render_field_with_errors(send_login_form.email) }} - {{ render_field(send_login_form.submit) }} -
-{% include "security/_menu.html" %} -{% endblock %} + {% include "security/_messages.html" %} +

{{ _fsdomain('Login') }}

+
+ {{ send_login_form.hidden_tag() }} + {{ render_field_with_errors(send_login_form.email) }} + {{ render_field(send_login_form.submit) }} +
+ {% include "security/_menu.html" %} +{% endblock content %} diff --git a/flask_security/templates/security/two_factor_select.html b/flask_security/templates/security/two_factor_select.html index fbb72c91..44d620fc 100644 --- a/flask_security/templates/security/two_factor_select.html +++ b/flask_security/templates/security/two_factor_select.html @@ -2,12 +2,12 @@ {% from "security/_macros.html" import prop_next, render_field_with_errors, render_field %} {% block content %} -{% include "security/_messages.html" %} -

{{ _fsdomain('Select Two Factor Method') }}

-
- {{ two_factor_select_form.hidden_tag() }} - {{ render_field_with_errors(two_factor_select_form.which) }} - {{ render_field(two_factor_select_form.submit) }} -
-{% include "security/_menu.html" %} -{% endblock %} + {% include "security/_messages.html" %} +

{{ _fsdomain('Select Two Factor Method') }}

+
+ {{ two_factor_select_form.hidden_tag() }} + {{ render_field_with_errors(two_factor_select_form.which) }} + {{ render_field(two_factor_select_form.submit) }} +
+ {% include "security/_menu.html" %} +{% endblock content %} diff --git a/flask_security/templates/security/two_factor_setup.html b/flask_security/templates/security/two_factor_setup.html index 8a377c54..d7055a3d 100644 --- a/flask_security/templates/security/two_factor_setup.html +++ b/flask_security/templates/security/two_factor_setup.html @@ -20,67 +20,63 @@ {% from "security/_macros.html" import render_field_with_errors, render_field, render_field_no_label, render_field_errors %} {% block content %} - {% include "security/_messages.html" %} -

{{ _fsdomain("Two-factor authentication adds an extra layer of security to your account") }}

-

{{ _fsdomain("In addition to your username and password, you'll need to use a code.") }}

-
- {{ two_factor_setup_form.hidden_tag() }} -
{{ _fsdomain("Currently setup two-factor method: %(method)s", method=primary_method) }}
-
- {% for subfield in two_factor_setup_form.setup %} - {% if subfield.data in choices %} - {{ render_field_with_errors(subfield) }} - {% endif %} - {% endfor %} - {{ render_field_errors(two_factor_setup_form.setup) }} - {{ render_field(two_factor_setup_form.submit) }} - {% if chosen_method=="email" and chosen_method in choices %} -
{{ _fsdomain("To complete logging in, please enter the code sent to your mail") }}
- {% endif %} - {% if chosen_method=="authenticator" and chosen_method in choices %} -
-
-
- {{ _fsdomain("Open an authenticator app on your device and scan the following QRcode (or enter the code below manually) to start receiving codes:") }} -
-
- {{ _fsdomain( -
-
- {{ authr_key }} -
-
- {% endif %} - {% if chosen_method=="sms" and chosen_method in choices %} -

{{ _fsdomain("To Which Phone Number Should We Send Code To?") }}

- {{ two_factor_setup_form.hidden_tag() }} - {{ render_field_with_errors(two_factor_setup_form.phone) }} - {{ render_field(two_factor_setup_form.submit) }} - {% endif %} -
- {% if security.webauthn and not chosen_method %} -

{{ _fsdomain("WebAuthn") }}

-
- {{ _fsdomain("This application supports WebAuthn security keys.") }} - {{ _fsdomain("You can set them up here.") }} -
+ {% include "security/_messages.html" %} +

{{ _fsdomain("Two-factor authentication adds an extra layer of security to your account") }}

+

{{ _fsdomain("In addition to your username and password, you'll need to use a code.") }}

+
+ {{ two_factor_setup_form.hidden_tag() }} +
{{ _fsdomain("Currently setup two-factor method: %(method)s", method=primary_method) }}
+
+ {% for subfield in two_factor_setup_form.setup %} + {% if subfield.data in choices %}{{ render_field_with_errors(subfield) }}{% endif %} + {% endfor %} + {{ render_field_errors(two_factor_setup_form.setup) }} + {{ render_field(two_factor_setup_form.submit) }} + {% if chosen_method=="email" and chosen_method in choices %} +
{{ _fsdomain("To complete logging in, please enter the code sent to your mail") }}
{% endif %} - {% if chosen_method %} - {# Hide this when first setting up #} + {% if chosen_method=="authenticator" and chosen_method in choices %}
- - {{ two_factor_verify_code_form.hidden_tag() }} - {{ render_field_with_errors(two_factor_verify_code_form.code) }} - {{ render_field(two_factor_verify_code_form.submit) }} -
- {% endif %} - {% if security.support_mfa and security.multi_factor_recovery_codes %} -

{{ _fsdomain("Recovery Codes") }}

-
- {{ _fsdomain("This application supports setting up recovery codes.") }} - {{ _fsdomain("You can set them up here.") }} +
+
+ {{ _fsdomain("Open an authenticator app on your device and scan the following QRcode (or enter the code below manually) to start receiving codes:") }} +
+
+ {{ _fsdomain('Two factor authentication code') }} + {# TODO: add width and heigth attrs #}%} +
+
{{ authr_key }}
{% endif %} - {% include "security/_menu.html" %} -{% endblock %} + {% if chosen_method=="sms" and chosen_method in choices %} +

{{ _fsdomain("To Which Phone Number Should We Send Code To?") }}

+ {{ two_factor_setup_form.hidden_tag() }} + {{ render_field_with_errors(two_factor_setup_form.phone) }} + {{ render_field(two_factor_setup_form.submit) }} + {% endif %} + + {% if security.webauthn and not chosen_method %} +

{{ _fsdomain("WebAuthn") }}

+
+ {{ _fsdomain("This application supports WebAuthn security keys.") }} + {{ _fsdomain("You can set them up here.") }} +
+ {% endif %} + {% if chosen_method %} + {# Hide this when first setting up #} +
+
+ {{ two_factor_verify_code_form.hidden_tag() }} + {{ render_field_with_errors(two_factor_verify_code_form.code) }} + {{ render_field(two_factor_verify_code_form.submit) }} +
+ {% endif %} + {% if security.support_mfa and security.multi_factor_recovery_codes %} +

{{ _fsdomain("Recovery Codes") }}

+
+ {{ _fsdomain("This application supports setting up recovery codes.") }} + {{ _fsdomain("You can set them up here.") }} +
+ {% endif %} + {% include "security/_menu.html" %} +{% endblock content %} diff --git a/flask_security/templates/security/two_factor_verify_code.html b/flask_security/templates/security/two_factor_verify_code.html index 63c8e27f..61cc41ff 100644 --- a/flask_security/templates/security/two_factor_verify_code.html +++ b/flask_security/templates/security/two_factor_verify_code.html @@ -2,26 +2,25 @@ {% from "security/_macros.html" import render_field_with_errors, render_field, prop_next %} {% block content %} - {% include "security/_messages.html" %} -

{{ _fsdomain("Two-factor Authentication") }}

-

{{ _fsdomain("Please enter your authentication code generated via: %(method)s", method=chosen_method) }}

-
- {{ two_factor_verify_code_form.hidden_tag() }} - {{ render_field_with_errors(two_factor_verify_code_form.code, placeholder="enter code") }} - {{ render_field(two_factor_verify_code_form.submit) }} -
-
-
- {{ two_factor_rescue_form.hidden_tag() }} - {{ render_field_with_errors(two_factor_rescue_form.help_setup) }} - {% if problem=="email" %} -
{{ _fsdomain("The code for authentication was sent to your email address") }}
- {% endif %} - {% if problem=="help" %} -
{{ _fsdomain("A mail was sent to us in order to reset your application account") }}
- {% endif %} - {{ render_field(two_factor_rescue_form.submit) }} -
- {% include "security/_menu.html" %} -{% endblock %} + {% include "security/_messages.html" %} +

{{ _fsdomain("Two-factor Authentication") }}

+

{{ _fsdomain("Please enter your authentication code generated via: %(method)s", method=chosen_method) }}

+
+ {{ two_factor_verify_code_form.hidden_tag() }} + {{ render_field_with_errors(two_factor_verify_code_form.code, placeholder="enter code") }} + {{ render_field(two_factor_verify_code_form.submit) }} +
+
+
+ {{ two_factor_rescue_form.hidden_tag() }} + {{ render_field_with_errors(two_factor_rescue_form.help_setup) }} + {% if problem=="email" %} +
{{ _fsdomain("The code for authentication was sent to your email address") }}
+ {% endif %} + {% if problem=="help" %} +
{{ _fsdomain("A mail was sent to us in order to reset your application account") }}
+ {% endif %} + {{ render_field(two_factor_rescue_form.submit) }} +
+ {% include "security/_menu.html" %} +{% endblock content %} diff --git a/flask_security/templates/security/us_setup.html b/flask_security/templates/security/us_setup.html index 0af21599..928d791f 100644 --- a/flask_security/templates/security/us_setup.html +++ b/flask_security/templates/security/us_setup.html @@ -24,82 +24,75 @@ {% from "security/_macros.html" import render_field_with_errors, render_field, render_field_errors, render_form_errors %} {% block content %} - {% include "security/_messages.html" %} -

{{ _fsdomain("Setup Unified Sign In") }}

-
- {{ us_setup_form.hidden_tag() }} - {{ render_form_errors(us_setup_form) }} - {% if setup_methods %} -
{{ _fsdomain("Currently active sign in options:") }} - {% if active_methods %} - {{ ", ".join(active_methods) }} - {% else %} - None. + {% include "security/_messages.html" %} +

{{ _fsdomain("Setup Unified Sign In") }}

+ + {{ us_setup_form.hidden_tag() }} + {{ render_form_errors(us_setup_form) }} + {% if setup_methods %} +
+ {{ _fsdomain("Currently active sign in options:") }} + + {% if active_methods %} + {{ ", ".join(active_methods) }} + {% else %} + None. + {% endif %} + +
+

{{ us_setup_form.chosen_method.label }}

+
+ {% for subfield in us_setup_form.chosen_method %}{{ render_field_with_errors(subfield) }}{% endfor %} + {{ render_field_errors(us_setup_form.chosen_method) }} +
+
+ {% if "sms" in available_methods and "sms" not in active_methods %} + {{ render_field_with_errors(us_setup_form.phone) }} {% endif %} -
- -

{{ us_setup_form.chosen_method.label }}

-
- {% for subfield in us_setup_form.chosen_method %} - {{ render_field_with_errors(subfield) }} - {% endfor %} - {{ render_field_errors(us_setup_form.chosen_method) }} -
- +
+ {% if us_setup_form.delete_method.choices and not state %} + {# don't show delete if we're trying to validate a setup #} +

{{ us_setup_form.delete_method.label }}

- {% if "sms" in available_methods and "sms" not in active_methods %} - {{ render_field_with_errors(us_setup_form.phone) }} - {% endif %} + {% for subfield in us_setup_form.delete_method %}{{ render_field_with_errors(subfield) }}{% endfor %} + {{ render_field_errors(us_setup_form.delete_method) }}
- {% if us_setup_form.delete_method.choices and not state %} - {# don't show delete if we're trying to validate a setup #} -

{{ us_setup_form.delete_method.label }}

-
- {% for subfield in us_setup_form.delete_method %} - {{ render_field_with_errors(subfield) }} - {% endfor %} - {{ render_field_errors(us_setup_form.delete_method) }} + {% endif %} +
{{ render_field(us_setup_form.submit) }}
+ {% if chosen_method == "authenticator" %} +
+
+
+ {{ _fsdomain("Open an authenticator app on your device and scan the following QRcode (or enter the code below manually) to start receiving codes:") }}
- {% endif %} -
{{ render_field(us_setup_form.submit) }}
- - {% if chosen_method == "authenticator" %} -
-
-
- {{ _fsdomain("Open an authenticator app on your device and scan the following QRcode (or enter the code below manually) to start receiving codes:") }} -
-
- {{ _fsdomain('Passwordless QRCode') }} -
-
- {{ authr_key }} -
+
+ {{ _fsdomain('Passwordless QRCode') }} + {# TODO: add width and heigth attrs #}%}
- {% endif %} - {% else %} -

{{ _fsdomain("No methods have been enabled - nothing to setup") }}

+
{{ authr_key }}
+
{% endif %} - - {% if state %} - {# Completing setup by entering code #} -
-
{{ _fsdomain("Enter code here to complete setup") }}
-
- {{ us_setup_validate_form.hidden_tag() }} - {{ render_field_with_errors(us_setup_validate_form.passcode) }} -
{{ render_field(us_setup_validate_form.submit) }}
-
+ {% else %} +

{{ _fsdomain("No methods have been enabled - nothing to setup") }}

{% endif %} - {% if security.webauthn %} -
-

WebAuthn

-
- {{ _fsdomain("This application supports WebAuthn security keys.") }} - {{ _fsdomain("You can set them up here.") }} -
- {% endif %} - {% include "security/_menu.html" %} -{% endblock %} + + {% if state %} + {# Completing setup by entering code #} +
+
{{ _fsdomain("Enter code here to complete setup") }}
+
+ {{ us_setup_validate_form.hidden_tag() }} + {{ render_field_with_errors(us_setup_validate_form.passcode) }} +
{{ render_field(us_setup_validate_form.submit) }}
+
+ {% endif %} + {% if security.webauthn %} +
+

WebAuthn

+
+ {{ _fsdomain("This application supports WebAuthn security keys.") }} + {{ _fsdomain("You can set them up here.") }} +
+ {% endif %} + {% include "security/_menu.html" %} +{% endblock content %} diff --git a/flask_security/templates/security/us_signin.html b/flask_security/templates/security/us_signin.html index 81764409..b29a43cb 100644 --- a/flask_security/templates/security/us_signin.html +++ b/flask_security/templates/security/us_signin.html @@ -2,34 +2,30 @@ {% from "security/_macros.html" import render_field_with_errors, render_field, render_field_errors, render_form_errors, prop_next %} {% block content %} - {% include "security/_messages.html" %} -

{{ _fsdomain("Sign In") }}

-
- {{ us_signin_form.hidden_tag() }} - {{ render_form_errors(us_signin_form) }} - {{ render_field_with_errors(us_signin_form.identity) }} - {{ render_field_with_errors(us_signin_form.passcode) }} - {{ render_field_with_errors(us_signin_form.remember) }} - {{ render_field(us_signin_form.submit) }} - {% if code_methods %} -

{{ _fsdomain("Request one-time code be sent") }}

- {% for subfield in us_signin_form.chosen_method %} - {% if subfield.data in code_methods %} - {{ render_field_with_errors(subfield) }} - {% endif %} - {% endfor %} - {{ render_field_errors(us_signin_form.chosen_method) }} - {{ render_field(us_signin_form.submit_send_code, formaction=url_for_security('us_signin_send_code')) }} - {% endif %} -
+ {% include "security/_messages.html" %} +

{{ _fsdomain("Sign In") }}

+
+ {{ us_signin_form.hidden_tag() }} + {{ render_form_errors(us_signin_form) }} + {{ render_field_with_errors(us_signin_form.identity) }} + {{ render_field_with_errors(us_signin_form.passcode) }} + {{ render_field_with_errors(us_signin_form.remember) }} + {{ render_field(us_signin_form.submit) }} + {% if code_methods %} +

{{ _fsdomain("Request one-time code be sent") }}

+ {% for subfield in us_signin_form.chosen_method %} + {% if subfield.data in code_methods %}{{ render_field_with_errors(subfield) }}{% endif %} + {% endfor %} + {{ render_field_errors(us_signin_form.chosen_method) }} + {{ render_field(us_signin_form.submit_send_code, formaction=url_for_security('us_signin_send_code')) }} + {% endif %} +
{% if security.webauthn %}

{{ _fsdomain("Use WebAuthn to Sign In") }}

-
-
- +
+ +
{% endif %} @@ -38,12 +34,11 @@

{{ _fsdomain("Use WebAuthn to Sign In") }}

{{ _fsdomain("Use Social Oauth to Sign In") }}

{% for provider in security.oauthglue.provider_names %}
-
- + +
{% endfor %} {% endif %} {% include "security/_menu.html" %} -{% endblock %} +{% endblock content %} diff --git a/flask_security/templates/security/us_verify.html b/flask_security/templates/security/us_verify.html index 99cfe68a..0efd6378 100644 --- a/flask_security/templates/security/us_verify.html +++ b/flask_security/templates/security/us_verify.html @@ -2,35 +2,31 @@ {% from "security/_macros.html" import render_field_with_errors, render_field, render_field_errors, prop_next %} {% block content %} - {% include "security/_messages.html" %} -

{{ _fsdomain("Please Reauthenticate") }}

-
- {{ us_verify_form.hidden_tag() }} - {{ render_field_with_errors(us_verify_form.passcode) }} - {{ render_field(us_verify_form.submit) }} - {% if code_methods %} -

{{ _fsdomain("Request one-time code be sent") }}

- {% for subfield in us_verify_form.chosen_method %} - {% if subfield.data in code_methods %} - {{ render_field_with_errors(subfield) }} - {% endif %} - {% endfor %} - {{ render_field_errors(us_verify_form.chosen_method) }} - {% if code_sent %} -

{{ _fsdomain("Code has been sent") }} - {% endif %} -

{{ render_field(us_verify_form.submit_send_code, formaction=url_for_security("us_verify_send_code")~prop_next()) }}
- {% endif %} -
- {% if has_webauthn_verify_credential %} -
-

{{ _fsdomain("Use a WebAuthn Security Key to Reauthenticate") }}

-
- {{ wan_verify_form.hidden_tag() }} - {{ render_field(wan_verify_form.submit) }} -
- {% endif %} + {% include "security/_messages.html" %} +

{{ _fsdomain("Please Reauthenticate") }}

+
+ {{ us_verify_form.hidden_tag() }} + {{ render_field_with_errors(us_verify_form.passcode) }} + {{ render_field(us_verify_form.submit) }} + {% if code_methods %} +

{{ _fsdomain("Request one-time code be sent") }}

+ {% for subfield in us_verify_form.chosen_method %} + {% if subfield.data in code_methods %}{{ render_field_with_errors(subfield) }}{% endif %} + {% endfor %} + {{ render_field_errors(us_verify_form.chosen_method) }} + {% if code_sent %}

{{ _fsdomain("Code has been sent") }}

{% endif %} +
+ {{ render_field(us_verify_form.submit_send_code, formaction=url_for_security("us_verify_send_code")~prop_next()) }} +
+ {% endif %} +
+ {% if has_webauthn_verify_credential %} +
+

{{ _fsdomain("Use a WebAuthn Security Key to Reauthenticate") }}

+
+ {{ wan_verify_form.hidden_tag() }} + {{ render_field(wan_verify_form.submit) }} +
+ {% endif %} {% include "security/_menu.html" %} -{% endblock %} +{% endblock content %} diff --git a/flask_security/templates/security/verify.html b/flask_security/templates/security/verify.html index b0875581..d90bd028 100644 --- a/flask_security/templates/security/verify.html +++ b/flask_security/templates/security/verify.html @@ -2,21 +2,19 @@ {% from "security/_macros.html" import render_field_with_errors, render_field, prop_next %} {% block content %} - {% include "security/_messages.html" %} -

{{ _fsdomain("Please Reauthenticate") }}

-
- {{ verify_form.hidden_tag() }} - {{ render_field_with_errors(verify_form.password) }} - {{ render_field(verify_form.submit) }} + {% include "security/_messages.html" %} +

{{ _fsdomain("Please Reauthenticate") }}

+ + {{ verify_form.hidden_tag() }} + {{ render_field_with_errors(verify_form.password) }} + {{ render_field(verify_form.submit) }} +
+ {% if has_webauthn_verify_credential %} +
+

{{ _fsdomain("Use a WebAuthn Security Key to Reauthenticate") }}

+
+ {{ wan_verify_form.hidden_tag() }} + {{ render_field(wan_verify_form.submit) }}
- {% if has_webauthn_verify_credential %} -
-

{{ _fsdomain("Use a WebAuthn Security Key to Reauthenticate") }}

-
- {{ wan_verify_form.hidden_tag() }} - {{ render_field(wan_verify_form.submit) }} -
- {% endif %} -{% endblock %} + {% endif %} +{% endblock content %} diff --git a/flask_security/templates/security/wan_register.html b/flask_security/templates/security/wan_register.html index de9de767..a54c09d8 100644 --- a/flask_security/templates/security/wan_register.html +++ b/flask_security/templates/security/wan_register.html @@ -7,8 +7,7 @@ {% block head_scripts %} {{ super() }} - + {% endblock head_scripts %} @@ -18,63 +17,58 @@

{{ _fsdomain("Setup New WebAuthn Security Key") }}

{% if not credential_options %} {# Initial form to get CreateOptions #}
{{ _fsdomain("Start by providing a unique name for your new security key:") }}
-
- {{ wan_register_form.hidden_tag() }} - {{ render_field_with_errors(wan_register_form.name) }} - {# Default is just second factor #} - {% if security.wan_allow_as_first_factor %} -
- {% for subfield in wan_register_form.usage %} - {{ render_field_with_errors(subfield) }} - {% endfor %} -
- {% endif %} - {{ render_field(wan_register_form.submit) }} + + {{ wan_register_form.hidden_tag() }} + {{ render_field_with_errors(wan_register_form.name) }} + {# Default is just second factor #} + {% if security.wan_allow_as_first_factor %} +
+ {% for subfield in wan_register_form.usage %}{{ render_field_with_errors(subfield) }}{% endfor %} +
+ {% endif %} + {{ render_field(wan_register_form.submit) }}
{% else %} -
+ {{ wan_register_response_form.hidden_tag() }}
- + {% endif %} - {% if registered_credentials %}

{{ _fsdomain("Currently registered security keys:") }}

{% set listing = _fsdomain('Nickname: "%s" Usage: "%s" Transports: "%s" Discoverable: "%s" Device Type: "%s" Backed up? "%s" Last used on: %s') %}
    {% for cred in registered_credentials %} -
  • {{ listing|format(cred.name, cred.usage, cred.transports|join(", "), cred.discoverable, cred.device_type, cred.backup_state, cred.lastuse)}}
  • +
  • + {{ listing|format(cred.name, cred.usage, cred.transports|join(", "), cred.discoverable, cred.device_type, cred.backup_state, cred.lastuse) }} +
  • {% endfor %}
{% endif %} - {% if wan_delete_form %}

{{ _fsdomain("Delete Existing WebAuthn Security Key") }}

-
- {{ wan_delete_form.hidden_tag() }} - {{ render_field_with_errors(wan_delete_form.name) }} - {{ render_field(wan_delete_form.submit) }} -
+
+ {{ wan_delete_form.hidden_tag() }} + {{ render_field_with_errors(wan_delete_form.name) }} + {{ render_field(wan_delete_form.submit) }} +
{% endif %} {% if security.support_mfa and security.multi_factor_recovery_codes %}
@@ -83,6 +77,6 @@

{{ _fsdomain("Recovery Codes") }}

{{ _fsdomain("This application supports setting up recovery codes.") }} {{ _fsdomain("You can set them up here.") }}
- {% endif %} + {% endif %} {% include "security/_menu.html" %} -{% endblock %} +{% endblock content %} diff --git a/flask_security/templates/security/wan_signin.html b/flask_security/templates/security/wan_signin.html index f93386a0..05b486d5 100644 --- a/flask_security/templates/security/wan_signin.html +++ b/flask_security/templates/security/wan_signin.html @@ -7,8 +7,7 @@ {% block head_scripts %} {{ super() }} - + {% endblock head_scripts %} @@ -20,8 +19,7 @@

{{ _fsdomain("Sign In Using WebAuthn Security Key") }}

{{ _fsdomain("Use Your WebAuthn Security Key as a Second Factor") }}

{% endif %} {% if not credential_options %} -
+ {{ wan_signin_form.hidden_tag() }} {% if not is_secondary %} {{ render_field_with_errors(wan_signin_form.identity) }} @@ -31,8 +29,7 @@

{{ _fsdomain("Use Your WebAuthn Security Key as a Second Factor") }}

{{ render_field(wan_signin_form.submit) }}
{% else %} -
+ {{ wan_signin_response_form.hidden_tag() }} {{ render_field_errors(wan_signin_form.remember) }} {# the following is important even though it is hidden - some browsers @@ -41,21 +38,21 @@

{{ _fsdomain("Use Your WebAuthn Security Key as a Second Factor") }}

{{ render_field(wan_signin_response_form.credential) }}
- + }); + {% endif %} -{% endblock %} +{% endblock content %} diff --git a/flask_security/templates/security/wan_verify.html b/flask_security/templates/security/wan_verify.html index 264db3dc..38e91337 100644 --- a/flask_security/templates/security/wan_verify.html +++ b/flask_security/templates/security/wan_verify.html @@ -12,8 +12,7 @@ {% block head_scripts %} {{ super() }} - + {% endblock head_scripts %} @@ -21,32 +20,30 @@ {% include "security/_messages.html" %}

{{ _fsdomain("Please Re-Authenticate Using Your WebAuthn Security Key") }}

{% if not credential_options %} -
- {{ wan_verify_form.hidden_tag() }} - {{ render_field(wan_verify_form.submit) }} + + {{ wan_verify_form.hidden_tag() }} + {{ render_field(wan_verify_form.submit) }}
{% else %} -
+ {{ wan_signin_response_form.hidden_tag() }}
- + }); + {% endif %} -{% endblock %} +{% endblock content %} diff --git a/requirements/tests.txt b/requirements/tests.txt index 8e8466bc..cfbba15e 100644 --- a/requirements/tests.txt +++ b/requirements/tests.txt @@ -13,6 +13,7 @@ bleach check-manifest coverage cryptography +djlint python-dateutil mongoengine mongomock