lenticular_cloud2/lenticular_cloud/template/frontend/passkey_new.html.j2

55 lines
1.2 KiB
Plaintext
Raw Permalink Normal View History

2023-12-25 16:28:09 +00:00
{#- This file is part of sner4 project governed by MIT license, see the LICENSE.txt file. -#}
{% extends 'frontend/base.html.j2' %}
{% block script %}
<script>
let options_req = {{ options }};
let token = "{{ token }}";
let form = document.getElementById('webauthn_register_form');
async function register() {
let credential = await auth_passkey.sign_up(options_req);
let name = form.querySelector('#name').value;
let response = await fetch("{{ url_for('.passkey_new_process') }}", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
token,
credential,
name
}),
})
}
form.onsubmit = ev => {
ev.preventDefault()
register().then( result => {
document.location = "{{ url_for('.passkey') }}";
})
};
</script>
{% endblock %}
{% block content %}
<div class="profile">
<h1>Register new Passkey credential</h1>
<div>
To register new credential:
<ol>
<li>Set name for the new credential.</li>
<li>Submit the registration.</li>
<li>Insert/connect authenticator and verify user presence.</li>
2023-12-25 16:28:09 +00:00
</ol>
</div>
{{ render_form(form, id="webauthn_register_form") }}
</div>
{% endblock %}