~tsileo/blobstash-app-webauthn-demo

ref: 6f50bda1356df4101a6dc2efbb7f66c5fcb28200 blobstash-app-webauthn-demo/templates/login.html -rw-r--r-- 627 bytes
6f50bda1Thomas Sileo Initial commit 7 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{{ define "body" }}
<p><a href="{{ url_for "/" }}">Register</a></p>
<p><a href="#" id="login_link">begin login</a></p>
<form action="" method="POST">
    <input type="text" id="rpayload" value="" name="data">
    <input type="submit" value="finish login">
</form>
<script src="{{ url_for_js "/webauthn.js" }}"></script>
<script>
var credentialRequestOptions = JSON.parse({{.js}});
document.getElementById("login_link").onclick = function() {
    Webauthn.login(credentialRequestOptions, payload => {
    console.log(payload);
    document.getElementById("rpayload").value = JSON.stringify(payload);
  });
}
</script>
{{ end }}