forked from fahrPool/fahrPool
docs: fix curl login verification technique in plan
The plain form-urlencoded curl POST in the manual verification steps does not work against a real Next.js Server Action (found during Task 3's manual verification). Documents the correct multipart/$ACTION_ID technique and the test admin credentials in Global Constraints so later tasks don't rediscover this.
This commit is contained in:
parent
c98e4ef28f
commit
133308adf8
|
|
@ -19,6 +19,20 @@
|
|||
- No changes to Server Actions, RLS policies, the data model, or any redirect/validation logic in `actions.ts` files — visual/structural changes only.
|
||||
- No dark mode (spec explicitly excludes it).
|
||||
- No new automated test dependencies (no `@testing-library/react`, no new test runner config). Verification per task is `npm run build` + `npm test` (existing Vitest suite must stay green) plus a manual/curl-based structural check. Full cross-browser/cross-breakpoint visual verification is done by the project owner in the running Docker container after all tasks land (per spec section 6) — do not attempt to spin up a headless browser for this.
|
||||
- **Corrected curl login technique** (the plain `curl -d "email=..." -d "password=..." -X POST .../login` shown in some task verification steps below does NOT work against a real Next.js Server Action and will be silently rejected — this was discovered and fixed during Task 3). `login` in `web/app/login/actions.ts` is an *unbound* Server Action; a real `<form>` submit encodes it as a hidden `multipart/form-data` field named `$ACTION_ID_<hash>` (the hash changes on every dev-server restart/rebuild — always re-read it fresh, never hardcode a previously seen value). Correct technique:
|
||||
```bash
|
||||
# 1. Read the current action id from the rendered page
|
||||
curl -s http://localhost:<port>/login | grep -o '\$ACTION_ID_[a-z0-9]*'
|
||||
# 2. Submit with that id as an empty multipart field, alongside the real form fields
|
||||
curl -s -c /tmp/cookies.txt -X POST http://localhost:<port>/login \
|
||||
-F '$ACTION_ID_<HASH>=' \
|
||||
-F 'email=admin@aushilfsfahrer.local' \
|
||||
-F 'password=Admin123!' \
|
||||
-L -o /tmp/response.html -w "HTTP_STATUS:%{http_code} FINAL_URL:%{url_effective}\n"
|
||||
# 3. Reuse the cookie jar for subsequent authenticated page fetches:
|
||||
curl -s -b /tmp/cookies.txt http://localhost:<port>/dashboard
|
||||
```
|
||||
A test admin user already exists in the local Supabase CLI dev stack (`npx supabase status` from the repo root to confirm it's running) for exactly this purpose: `admin@aushilfsfahrer.local` / `Admin123!`, profile name `Admin`, role `admin`. Also note: this worktree's `web/.env.local` (gitignored) must point at the local CLI dev stack (`http://127.0.0.1:54321` + the real anon key from `npx supabase status`), not the master Docker-Compose stack — verify this first if login curls return `E-Mail oder Passwort ist falsch.` despite correct credentials.
|
||||
|
||||
---
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue