docs: update account flow (username admin/1234 + forced setup) in README/HANDOFF/engineering-log

This commit is contained in:
Macky
2026-08-07 18:04:18 +07:00
parent e8a95bf561
commit 681561c22a
5 changed files with 41 additions and 6 deletions

View File

@@ -54,7 +54,8 @@ npm install
npm run dev # Vite on :3000 -> proxies /api to :5001 npm run dev # Vite on :3000 -> proxies /api to :5001
``` ```
The first run creates a default super-admin: **`admin@salestrainer.local` / `admin123`** (change it!). The first run creates a default super-admin: **username `admin` / password `1234`**.
On first login you'll be **forced to set your email + change the password** before using the app.
### Docker / EasyPanel ### Docker / EasyPanel
@@ -112,8 +113,8 @@ Real-model verification requires a live `LLM_API_KEY` in `.env`.
## Default accounts ## Default accounts
| Role | Email | Password | | Role | Username | Password |
|------|-------|----------| |------|----------|----------|
| super_admin | `admin@salestrainer.local` | `admin123` (change after first login) | | super_admin | `admin` | `1234` (forced to set email + change on first login) |
Admins create additional users (users/login has no self-registration). Admins create additional users (users/login has no self-registration).

View File

@@ -34,7 +34,8 @@ cd frontend && npm run build # outputs frontend/dist
``` ```
## Default account ## Default account
- super_admin: `admin@salestrainer.local` / `admin123` (bootstrap; change in prod). - super_admin: `admin` / `1234` (bootstrap). First login FORCES setting email + changing the
password (must_setup flow) before use.
## Key gotchas ## Key gotchas
1. **Do NOT invoke `.venv/bin/python <script>` directly** — the tool lifecycle guard crashes 1. **Do NOT invoke `.venv/bin/python <script>` directly** — the tool lifecycle guard crashes

View File

@@ -34,3 +34,4 @@ Informed by MiroFish (CrowdSight engine) + the hermes-brain-and-tools CrowdSight
## Entry index ## Entry index
- `2026-08-07-build-out.md` — M0M7 build-out, decisions, verification, current state. - `2026-08-07-build-out.md` — M0M7 build-out, decisions, verification, current state.
- `2026-08-07-security-ux.md` — security hardening (path traversal, IDOR, XSS) + UX/UI polish. - `2026-08-07-security-ux.md` — security hardening (path traversal, IDOR, XSS) + UX/UI polish.
- `2026-08-07-auth-gitea.md` — username login + first-time admin setup + Gitea push.

View File

@@ -0,0 +1,32 @@
# 2026-08-07 — Username-based login + first-time admin setup + Gitea push
## Summary
Changed the account model to **username-based login** (was email-as-id), added mandatory
first-time admin setup (set email + change password), pushed the repo to Gitea.
## Changes
1. **User id = username** (was email). Email is now a separate optional field with uniqueness.
- `UserStore.create_user(username, email=None, ...)`; login via username; JWT `sub` = username.
- Admin user-creation uses `username` (email fallback kept for compatibility).
2. **Default admin**: `admin` / `1234`, with `must_setup=True`.
3. **Forced first-time setup**: after login with the default creds, the frontend router guards
and sends the user to `/setup` — set email + new password (+ confirm), then `must_setup` clears.
- Backend: new `POST /api/auth/setup` (`complete_setup` sets email + password, clears flag).
- Login response now includes `must_setup`; `me` includes it too.
- Frontend: `Login.vue` uses username, `Setup.vue` (new), router guard, `auth.finishSetup`.
4. **Docs**: README + HANDOFF + build-out log updated to `admin`/`1234` + setup flow.
## Verification
- Added `test_setup.py` (admin/1234 → must_setup → set email+password → old pw invalid, new pw
works, admin can use app). ALL PASS.
- Adapted m0/m1/routes/security/e2e to username creds. **All 6 suites PASS.**
- Frontend `npm run build` ok. Live server: `admin`/`1234` login returns `must_setup=true`,
SPA served at `http://localhost:5001`.
## Push
- Remote added: `origin` = https://git.moreminimore.com/kunthawat/sales-trainer.git
(GITEA_TOKEN via env, not committed). Pushed `main``eadf4f7..e8a95bf`.
## Next (needs user for live model, no blocker here)
- Set `LLM_API_KEY` (+ provider) to enable analyze/persona/chat live path.
- Validate Docker build on EasyPanel.

View File

@@ -54,7 +54,7 @@ sessions→debrief(latent reveal+coaching)→one-shot→board→weak-areas→gen
## Current state / runtime ## Current state / runtime
- Backend runs via `cd backend && uv run python run.py`; frontend dev via `cd frontend && npm run dev` (proxies /api -> :5001). - Backend runs via `cd backend && uv run python run.py`; frontend dev via `cd frontend && npm run dev` (proxies /api -> :5001).
- Default super-admin: `admin@salestrainer.local` / `admin123` (bootstrap; change in prod). - Default super-admin: `admin` / `1234` (bootstrap; forces email + password change on first login).
- Deploy files: root `Dockerfile`, `docker-compose.yml`, `.env.example`; repo-root `frontend/dist` build. - Deploy files: root `Dockerfile`, `docker-compose.yml`, `.env.example`; repo-root `frontend/dist` build.
## Risks / remaining ## Risks / remaining