{# Common macros from the original flask-security that we'll override here for additional styling. #} {% macro render_field_with_errors(field) %}
{{ field.label }} {{ field(**kwargs)|safe }} {% if field.errors %}
{% endif %}
{% endmacro %} {% macro render_field(field) %}
{{ field(**kwargs)|safe }}
{% endmacro %} {# Adding the following macro from the original flask-security because the TFA code will now only look for these macros here. #} {# For storing the next URL #} {% macro prop_next() -%} {% if 'next' in request.args %}?next={{ request.args.next|urlencode }}{% endif %} {%- endmacro %} {# For forms that have multiple POST forms - explicitly render csrf_token so we can change the ID so we don't get duplicates #} {% macro render_csrf(form, pfx) %} {% set csrf_field_name = form.meta.csrf_field_name | default %} {% if form[csrf_field_name] is defined %} {{ form[csrf_field_name](id=pfx~'-csrf') }} {% endif %} {% endmacro %}