···55 <header>
66 <details>
77 <summary>Authentication</summary>
88- <div hx-get="/htmx/user_slug" hx-trigger="login from:body, load" hx-swap="innerHTML"></div>
88+ <script type="module">
99+ const span = document.querySelector("#authentication_span");
1010+1111+ const req = await fetch("/user/info", { method: "POST" });
1212+1313+ if (req.ok) {
1414+ const user = await req.json();
1515+1616+ const body = `You are logged in. Your user ID is ${user.id}.
1717+ <br> You are in timezone ${user.timezone}.
1818+ <br><br> Your login code is <samp><input value=\"${user.pass}\" readonly></samp>.
1919+ <br> Use this to log in on other devices. If you want to ensure your tasks are saved, write this code down.`;
2020+ span.innerHTML = body;
2121+ } else {
2222+ const body = `You are not logged in`;
2323+ span.innerHTML = body;
2424+ }
2525+ </script>
2626+ <span id="authentication_span"></span>
927 <br />
1010- <form hx-post="/user/login" hx-swap="none">
2828+ <form method="POST" action="/user/login" id="user-login">
1129 <label>Login with code: <br /><input name="pass" /></label>
1230 <br /><button>Ok</button>
1331 </form>
···4361 <p>Acknowledgements:</p>
4462 <ul>
4563 <li>Axum for a lovely Rust web server.</li>
4646- <li>HTMX for dead easy single-page-app prototyping.</li>
4764 <li>
4865 This lovely paper background.
4966 <a href="https://projects.verou.me/css3patterns/#lined-paper">Thanks!</a>