about summary refs log tree commit diff
path: root/kittybox-rs
diff options
context:
space:
mode:
Diffstat (limited to 'kittybox-rs')
-rw-r--r--kittybox-rs/javascript/src/indieauth.ts2
-rw-r--r--kittybox-rs/templates/src/indieauth.rs7
2 files changed, 7 insertions, 2 deletions
diff --git a/kittybox-rs/javascript/src/indieauth.ts b/kittybox-rs/javascript/src/indieauth.ts
index 8222070..ef314e9 100644
--- a/kittybox-rs/javascript/src/indieauth.ts
+++ b/kittybox-rs/javascript/src/indieauth.ts
@@ -63,7 +63,7 @@ async function webauthn_authenticate() {
   }
 }
 
-async function submit_handler(e: SubmitEvent) {
+export async function submit_handler(e: SubmitEvent) {
   e.preventDefault();
   if (e.target != null && e.target instanceof HTMLFormElement) {
     const form = e.target as HTMLFormElement;
diff --git a/kittybox-rs/templates/src/indieauth.rs b/kittybox-rs/templates/src/indieauth.rs
index 23f64e9..254b273 100644
--- a/kittybox-rs/templates/src/indieauth.rs
+++ b/kittybox-rs/templates/src/indieauth.rs
@@ -8,7 +8,12 @@ markup::define! {
         app: serde_json::Value,
         user: serde_json::Value
     ) {
-        script[src="/.kittybox/static/indieauth.js", type="module"] {}
+        script[type="module"] {
+            @markup::raw(r#"import { submit_handler } from "/.kittybox/static/indieauth.js";
+
+document.getElementById("indieauth_form").onSubmit = submit_handler;
+"#)
+        }
         main {
             form #indieauth_page[action="/.kittybox/indieauth/auth/confirm", method="POST"] {
                 noscript {