fix: make sure things load properly on login/signup

This commit is contained in:
Andy Burke 2025-09-12 11:41:15 -07:00
parent f760156651
commit e52a9e997c
5 changed files with 81 additions and 61 deletions

View file

@ -24,14 +24,15 @@
#signup-login-wall .limiter {
width: 95%;
position: relative;
background: rgba(128, 128, 128, 0.5);
background: hsl(from var(--bg) h s 15);
max-width: 40em;
min-height: 22rem;
margin: 0 auto;
}
#signup-login-wall form {
width: 100%;
padding: 1rem;
padding: 1.5rem;
}
</style>
@ -54,10 +55,13 @@
{
const form = document.currentScript.closest("form");
form.on_reply = (response) => {
// TODO: we should hold the session secret only in memory, not the cookie?
document.body.dataset.user = JSON.stringify(response.user);
document.body.dataset.perms =
response.user.permissions.join(":");
const user = response.user;
document.body.dataset.user = JSON.stringify(user);
document.body.dataset.perms = user.permissions.join(":");
document.dispatchEvent(
new CustomEvent("user_logged_in", { detail: { user } }),
);
};
}
</script>
@ -91,9 +95,13 @@
{
const form = document.currentScript.closest("form");
form.on_reply = (response) => {
document.body.dataset.user = JSON.stringify(response.user);
document.body.dataset.perms =
response.user.permissions.join(":");
const user = response.user;
document.body.dataset.user = JSON.stringify(user);
document.body.dataset.perms = user.permissions.join(":");
document.dispatchEvent(
new CustomEvent("user_logged_in", { detail: { user } }),
);
};
}
</script>