Commit graph

6 commits

Author SHA1 Message Date
senke
083b5718a7 feat(auth): defer JWT to post-verify + verify-email header (v1.0.9 items 1.3+1.4)
Item 1.4 — Register no longer issues an access+refresh token pair. The
prior flow set httpOnly cookies at register but the AuthMiddleware
refused them on every protected route until the user had verified
their email (`core/auth/service.go:527`). Users ended up with dead
credentials and a "logged in but locked out" UX. Register now returns
{user, verification_required: true, message} and the SPA's existing
"check your email" notice fires naturally.

Item 1.3 — `POST /auth/verify-email` reads the token from the
`X-Verify-Token` header in preference to the `?token=…` query param.
Query param logged a deprecation warning but stays accepted so emails
dispatched before this release still work. Headers don't leak through
proxy/CDN access logs that record URL but not headers.

Tests: 18 test files updated (sed `_, _, err :=` → `_, err :=` for the
new Register signature). `core/auth/handler_test.go` gets a
`registerVerifyLogin` helper for tests that exercise post-login flows
(refresh, logout). Two new E2E `@critical` specs lock in the defer-JWT
contract and the header read-path.

OpenAPI + orval regenerated to reflect the new RegisterResponse shape
and the verify-email header parameter.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 22:56:31 +02:00
senke
2df921abd5 v0.9.1 2026-03-05 19:22:31 +01:00
senke
759154e660 fix(auth): add Redis lock for concurrent refresh token requests 2026-02-14 18:29:37 +01:00
senke
744a98ede9 [WIP] Register: Code modifié mais échoue avec 500 - diagnostic en cours
- Modifié Register() pour générer tokens JWT
- Corrigé signature: (*User, *TokenPair, error)
- Corrigé handlers et tests
- Register échoue maintenant avec 'Failed to create user' (code 9000)
- Erreur DB non visible dans les logs - nécessite diagnostic approfondi
2026-01-04 01:44:14 +01:00
senke
1ebbb06315 [FE-PAGE-015] fe-page: Add Analytics page 2025-12-25 11:25:06 +01:00
senke
e4946db347 [BE-TEST-022] be-test: Add tests for 2FA flow
- Created comprehensive 2FA flow test suite
- Tests cover 2FA setup (secret generation, QR code, recovery codes)
- Tests cover verification and activation with TOTP codes
- Tests cover login flow with 2FA requirement
- Tests cover status checking and TOTP code validation
- Tests cover complete end-to-end flow (setup -> verify -> login)
- Tests handle SQLite compatibility (GORM for EnableTwoFactor)
- Tests verify error cases (already enabled, invalid codes)
- Tests verify recovery codes generation

Phase: PHASE-5
Priority: P2
Progress: 143/267 (53.56%)
2025-12-25 02:21:16 +01:00