55 lines
1.2 KiB
Plaintext
55 lines
1.2 KiB
Plaintext
|
{#- 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>Insert/connect authenticator and verify user presence.</li>
|
||
|
<li>Set name for the new credential.</li>
|
||
|
<li>Submit the registration.</li>
|
||
|
</ol>
|
||
|
</div>
|
||
|
|
||
|
{{ render_form(form, id="webauthn_register_form") }}
|
||
|
</div>
|
||
|
{% endblock %}
|