Add account settings page and polish avatar/SSO button edge cases

- New /account route: edit name/email, change password, delete account
  (detaches the user's orders instead of leaving a dangling reference,
  since orders.customerId has no DB-level FK to better-auth's user table)
- Better Auth: allow email changes without a verification email (no
  email sending is wired up anywhere in this app) and enable account
  deletion
- Header avatar: fall back to the initials placeholder if the profile
  image fails to load, not just when there's no image URL
- Fix low-contrast "Continue with Google" button in dark mode (it used
  the page background color and a hardcoded dark-gray label, so it
  nearly disappeared against a dark background)

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-30 22:23:50 +02:00
co-authored by Claude Sonnet 5
parent 7f72baf97d
commit 815939cbc6
9 changed files with 483 additions and 4 deletions
+11
View File
@@ -33,3 +33,14 @@ export const requireAdminSession = createServerFn({ method: 'GET' }).handler(
await requireAdmin()
},
)
// The account settings route's loader calls this to both fetch the
// signed-in user and gate the page — thrown message is matched against by
// the route the same way withAdminGuard matches "Admin access required".
export const getCurrentUser = createServerFn({ method: 'GET' }).handler(
async () => {
const user = await getSessionUser()
if (!user) throw new Error('Not signed in')
return user
},
)