feat(auth): role-agnostic self-service surface under /auth/me #76
Reference in New Issue
Block a user
No description provided.
Delete Branch "feat/auth-me-self-surface"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What & why
Adds
/auth/me/account*— the canonical role-agnostic self-service surface for every authenticated role. This is Android-app prerequisite §8 item 1 (docs/android/PLAN.md §6.4): the app wants one "me" surface it can call regardless of role, and it must never touch/admin.It reuses the existing
account.controllerhandlers verbatim (no logic duplication) behindrequireAuthonly — any active account, never a specific role. The older/player/account/*and/admin/account/*routes stay for web back-compat.New routes (cookie- or bearer-auth, any active role):
GET /auth/me/accountPATCH /auth/me/account/usernamePATCH /auth/me/account/passwordPOST /auth/me/account/totp/setup|enable|disableGET /auth/me/account/identitiesDELETE /auth/me/account/identities/:providerMounted as a
me.routes.jssub-router at/me; the bareGET /auth/meis unchanged. OpenAPI/Swagger regenerated with#swaggerannotations.How it was tested
npm test(server) — all tests pass, incl. the newtest/authMe.test.js(the/auth/me/*group gate rejects unauthenticated callers with 401 across every verb/route).GET /auth/me+/auth/me/account(full account incl.has_password,email).PATCH usernameupdates the DB; validation rejects bad username / short password with 400.PATCH passwordsucceeds and revokes the caller's old bearer token (subsequent call → 401); wrongcurrentPassword→ 400.editor(staff) drives the same/auth/me/accountsurface (200,role=editor) and changes its own username — never touching/admin.Checklist
AI-assisted contributions (required)
Claude Code (Claude Opus 4.8). I have reviewed and understand every change, and take responsibility for it. AI-authored commits are marked with aCo-Authored-Bytrailer.License
Docs counterpart updates
BACKEND_DESIGN.md(the/auth/me/*rows) and marks PLAN §8 item 1 done.🤖 Generated with Claude Code
https://claude.ai/code/session_01NgyHnrNa8WwG3doxvxjuCr