Enhance user profile management and Gravatar integration
- Added email field to user profile API and frontend components for better user identification. - Implemented PATCH /map/api/me endpoint to update user email, enhancing user experience. - Introduced useGravatarUrl composable for generating Gravatar URLs based on user email. - Updated profile and layout components to display user avatars using Gravatar, improving visual consistency. - Enhanced development documentation to guide testing of navbar and profile features.
This commit is contained in:
@@ -5,7 +5,7 @@ The API is available under the `/map/api/` prefix. Requests requiring authentica
|
||||
## Authentication
|
||||
|
||||
- **POST /map/api/login** — sign in. Body: `{"user":"...","pass":"..."}`. On success returns JSON with user data and sets a session cookie. On first run, bootstrap is available: logging in as `admin` with the password from `HNHMAP_BOOTSTRAP_PASSWORD` creates the first admin user. For users created via OAuth (no password), returns 401 with `{"error":"Use OAuth to sign in"}`.
|
||||
- **GET /map/api/me** — current user (by session). Response: `username`, `auths`, and optionally `tokens`, `prefix`.
|
||||
- **GET /map/api/me** — current user (by session). Response: `username`, `auths`, and optionally `tokens`, `prefix`, `email` (string, optional — for Gravatar and display).
|
||||
- **POST /map/api/logout** — sign out (invalidates the session).
|
||||
- **GET /map/api/setup** — check if initial setup is needed. Response: `{"setupRequired": true|false}`.
|
||||
|
||||
@@ -17,6 +17,7 @@ The API is available under the `/map/api/` prefix. Requests requiring authentica
|
||||
|
||||
## User account
|
||||
|
||||
- **PATCH /map/api/me** — update current user. Body: `{"email": "..."}`. Used to set or change the user's email (for Gravatar and profile display). Requires a valid session.
|
||||
- **POST /map/api/me/tokens** — generate a new upload token (requires `upload` permission). Response: `{"tokens": ["...", ...]}`.
|
||||
- **POST /map/api/me/password** — change password. Body: `{"pass":"..."}`.
|
||||
|
||||
|
||||
@@ -49,6 +49,10 @@ The dev Compose setup starts two services:
|
||||
Use [http://localhost:3000/](http://localhost:3000/) as the primary URL for UI development.
|
||||
Port `3080` is for API and backend endpoints; the root `/` may return `404` in dev mode — this is expected.
|
||||
|
||||
**Testing navbar and profile:** With no users in the database, log in as `admin` using the bootstrap password (e.g. `HNHMAP_BOOTSTRAP_PASSWORD=admin` in docker-compose.dev) to create the first admin user. You can then use that account to verify the navbar avatar and profile page. For Gravatar, use OAuth (e.g. Google) or set email later on the profile page once that feature is available.
|
||||
|
||||
**Gravatar (avatar by email):** Gravatar URLs are built on the frontend using the `md5` package (client-side MD5 of the user's email). No backend endpoint is used; the frontend composable `useGravatarUrl` (see Phase 5+ of the navbar/avatar plan) will use this dependency.
|
||||
|
||||
### Building the image and production Compose
|
||||
|
||||
```bash
|
||||
|
||||
Reference in New Issue
Block a user