diff options
| author | Rose Hogenson <rosehogenson@posteo.net> | 2026-10-20 21:02:18 -0700 |
|---|---|---|
| committer | Rose Hogenson <rosehogenson@posteo.net> | 2026-10-20 21:09:43 -0700 |
| commit | b678e28d4acaecb234831f39f8000912ed2d7200 (patch) | |
| tree | 53f3c402f0bde0f5b037efca94f31c2176127efc /templates | |
| parent | Add HSTS header (diff) | |
| download | roseh.moe-b678e28d4acaecb234831f39f8000912ed2d7200.tar.zst | |
Some small simplifications
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/login.html.template | 24 | ||||
| -rw-r--r-- | templates/register/register-success.html.template | 2 | ||||
| -rw-r--r-- | templates/register/register.html.template | 51 |
3 files changed, 38 insertions, 39 deletions
diff --git a/templates/login.html.template b/templates/login.html.template index ae0874a..2a498a5 100644 --- a/templates/login.html.template +++ b/templates/login.html.template @@ -27,19 +27,19 @@ </form> <script> -async function main() { - const publicKeyCredential = await navigator.credentials.get({publicKey: { - challenge: Uint8Array.fromBase64("{{.Challenge}}").buffer, - }}); - const rsp = publicKeyCredential.response; - document.getElementById("user").value = new Uint8Array(rsp.userHandle).toBase64(); - document.getElementById("auth-data").value = new Uint8Array(rsp.authenticatorData).toBase64(); - document.getElementById("client-data").value = new Uint8Array(rsp.clientDataJSON).toBase64(); - document.getElementById("sig").value = new Uint8Array(rsp.signature).toBase64(); - document.getElementById("form").submit(); -} + async function main() { + const publicKeyCredential = await navigator.credentials.get({publicKey: { + challenge: Uint8Array.fromBase64("{{.Challenge}}").buffer, + }}); + const rsp = publicKeyCredential.response; + document.getElementById("user").value = new Uint8Array(rsp.userHandle).toBase64(); + document.getElementById("auth-data").value = new Uint8Array(rsp.authenticatorData).toBase64(); + document.getElementById("client-data").value = new Uint8Array(rsp.clientDataJSON).toBase64(); + document.getElementById("sig").value = new Uint8Array(rsp.signature).toBase64(); + document.getElementById("form").submit(); + } -main(); + main(); </script> This page requires JavaScriptâ„¢ to be enabled diff --git a/templates/register/register-success.html.template b/templates/register/register-success.html.template index 847f97a..d9c64e1 100644 --- a/templates/register/register-success.html.template +++ b/templates/register/register-success.html.template @@ -24,5 +24,5 @@ <p>A device key has been generated, but it must be authorized on the server:</p> <pre> <Passkey ID="{{.ID | xmlEscape}}" - Key="{{.Key | xmlEscape}}"/></pre> + Key="{{.Key}}"/></pre> </section> diff --git a/templates/register/register.html.template b/templates/register/register.html.template index 833a1a7..d97b585 100644 --- a/templates/register/register.html.template +++ b/templates/register/register.html.template @@ -37,30 +37,29 @@ </section> <script> -async function generateKey() { - const name = document.getElementById("name").value; - const publicKeyCredential = await navigator.credentials.create({publicKey: { - authenticatorSelection: { - residentKey: "required", - userVerification: "required", - }, - challenge: Uint8Array.fromBase64("{{.Challenge}}").buffer, - pubKeyCredParams: [ - {alg: -9, type: "public-key"}, - {alg: -257, type: "public-key"}, - {alg: -7, type: "public-key"}, - {alg: -8, type: "public-key"}, - ], - rp: { - name: "roseh.moe", - }, - user: { - displayName: name, - id: Uint8Array.fromBase64(document.getElementById("id").value).buffer, - name: name, - }, - }}); - document.getElementById("key").value = new Uint8Array(publicKeyCredential.response.getPublicKey()).toBase64(); - document.getElementById("form").submit(); -} + async function generateKey() { + const name = document.getElementById("name").value; + const publicKeyCredential = await navigator.credentials.create({publicKey: { + authenticatorSelection: { + residentKey: "required", + userVerification: "required", + }, + challenge: Uint8Array.fromBase64("{{.Challenge}}").buffer, + pubKeyCredParams: [ + {alg: -9, type: "public-key"}, + {alg: -257, type: "public-key"}, + {alg: -7, type: "public-key"}, + ], + rp: { + name: "roseh.moe", + }, + user: { + displayName: name, + id: Uint8Array.fromBase64(document.getElementById("id").value).buffer, + name: name, + }, + }}); + document.getElementById("key").value = new Uint8Array(publicKeyCredential.response.getPublicKey()).toBase64(); + document.getElementById("form").submit(); + } </script> |
