diff --git a/frontend/auth.js b/frontend/auth.js index 145f755..323c570 100644 --- a/frontend/auth.js +++ b/frontend/auth.js @@ -20,6 +20,12 @@ ); } + function getEmail() { + const model = pb.authStore.model || {}; + // Prefer email, but fall back to username if email missing + return model.email || model.username || null; + } + async function ensureAuth() { if (pb.authStore.isValid) return true; const path = new URL(window.location.href).pathname; @@ -29,5 +35,5 @@ return false; } - global.Auth = { pb, authHeaders, ensureAuth, getDisplayName }; + global.Auth = { pb, authHeaders, ensureAuth, getDisplayName, getEmail }; })(window); diff --git a/frontend/index.html b/frontend/index.html index cc0ef52..122c885 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -56,7 +56,10 @@
-