Debian Codegraph @

flask_security/templates/security/wan_verify.html

raw
1 {#
2 This template receives the following pieces of context in addition to the form:
3
4 wan_verify_form -
5 wan_signin_response_form -
6 skip_login_menu - True
7 Any other context provided by the "wan_verify" context processer.
8 #}
9 {% set title = title|default(_fsdomain("Reauthenticate")) %}
10 {% extends "security/base.html" %}
11 {% from "security/_macros.html" import render_field_with_errors, render_field, prop_next, script_nonce %}
12
13 {% block head_scripts %}
14 {{ super() }}
15 <script {{ script_nonce() }} src="{{ url_for('.static', filename='js/webauthn.js') }}"></script>
16 <script {{ script_nonce() }} src="{{ url_for('.static', filename='js/base64.js') }}"></script>
17 {% endblock head_scripts %}
18
19 {% block content %}
20 {% include "security/_messages.html" %}
21 <h1>{{ _fsdomain("Reauthenticate Using a Passkey") }}</h1>
22 {% if not credential_options %}
23 <form action="{{ url_for_security('wan_verify') }}{{ prop_next() }}" method="post" name="wan_verify_form">
24 {{ wan_verify_form.hidden_tag() }}
25 {{ render_field(wan_verify_form.submit) }}
26 </form>
27 {% else %}
28 <form action="{{ url_for_security('wan_verify_response', token=wan_state) }}{{ prop_next() }}" method="post" name="wan_signin_response_form" id="wan-signin-response-form">
29 {{ wan_signin_response_form.hidden_tag() }}
30 <div id="wan-errors"></div>
31 </form>
32 <script {{ script_nonce() }} type="text/javascript">
33 handleSignin('{{ credential_options|safe }}')
34 .then((result) => {
35 if (result.credential) {
36 document.getElementById("credential").value = result.credential;
37 {# We auto-submit this form - there is a Submit button on the
38 form we could use - but there really isn't any reason to force the
39 user to click yet another button
40 #}
41 document.forms["wan-signin-response-form"].submit();
42 } else {
43 const error_element = document.getElementById("wan-errors");
44 error_element.innerHTML = `<em>${result.error_msg}</em>`;
45 }
46 });
47 </script>
48 {% endif %}
49 {% endblock content %}