feat(showcase): accounts app — register/login/JWT/me (Phase 4)#526
Merged
Conversation
Adds auth-flow coverage. Exercises:
- rustango::passwords::{hash, verify} round-trip via register + login
- rustango::jwt::{encode, decode} round-trip via login → /me handshake
- Bearer-token header parsing on the protected route
- unique constraint on both username and email
- 8-char minimum password validation
- auto_now_add timestamp on user creation (via existing
re-fetch-after-insert pattern from blog/shop)
## Routes
POST /accounts/register {username, email, password} → 201 user
POST /accounts/login {username, password} → 200 {token, user}
GET /accounts/me Bearer <token> → 200 user
Error shapes:
- 400 on short password
- 401 on bad credentials, unknown user, missing header, malformed
header, tampered token
- 409 on duplicate username/email
## JWT secret
SHOWCASE_JWT_SECRET env var; playwright config sets it for
deterministic test runs. Falls back to a fixed dev secret string.
## Playwright
10 new tests under e2e/tests/accounts/. Suite is now 23/23 passing
locally (2 smoke + 5 blog + 6 shop + 10 accounts).
Adds @types/node to the e2e package so the playwright config's
`process.env` reads typecheck cleanly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 4 of the E2E showcase plan. Adds the `accounts` sub-app exercising the framework's auth primitives:
Routes
Error coverage:
Playwright
10 new tests under `e2e/tests/accounts/`. Suite is now 23/23 passing locally (2 smoke + 5 blog + 6 shop + 10 accounts).
`SHOWCASE_JWT_SECRET` env wired through the playwright config so test runs are deterministic. Adds `@types/node` so the config's `process.env` reads typecheck cleanly.
CI matrix
Same shape as phases 2-3 — 23 tests against postgres / mysql / sqlite per matrix row.