-
Lead VietProDev authored
Wire the OIDC /interaction/:uid/register handler end-to-end so a brand- new account is created in 'pending_verification' status, a single-use token is persisted (SHA-256 hashed) in email_verify_tokens, and a verify-pending screen is rendered instead of the previous 501 stub. Auto-login is intentionally skipped: the user must click the link in the verification email before sign-in is allowed. Highlights: - EmailVerificationService: mints tokens, persists hashes, queues mail via MailService; dev mode returns the raw verify URL so the flow is testable without a working SMTP transport. - New POST /:uid/resend-verification: re-issues a fresh token; the response is identical for known and unknown emails to avoid leaking account existence. - Default 'user' role is assigned inside the same transaction as User + UserAuth creation; missing role is non-fatal. - New view verify-pending.hbs with resend + back-to-sign-in actions. - register.hbs upgraded to a 2-column responsive grid covering all OIDC profile fields (name, phone, gender, address, DOB) plus a required terms_accepted checkbox. - 8 unit tests in tests/unit/services/emailVerification.service.test.ts (buildVerificationUrl, createToken hash, verifyToken outcomes, resendVerificationEmail guard) - all passing. - RUN.md gained section 6.5 'Email Verification Flow' with REST/OIDC step-by-step, dev mode fallback, curl examples, env vars and a manual test checklist. - PROGRESS.md updated to log Phase 3 re-apply + Phase 4 + Phase 5, pre-existing TS errors out of scope, and rollback cheatsheet. Phase 4b (fix pre-existing TS errors in src/controllers/api/v1/auth/{verify-email,resend-verification}.ts and src/server.ts) is documented but deliberately out of scope for this commit to keep the blast radius small. Refs: pending_verification, email_verified_at columns, email_verify_tokens table (migration 040) Co-authored-by:Cursor <cursoragent@cursor.com>
9ee96c4b
| Name |
Last commit
|
Last update |
|---|---|---|
| .. | ||
| maintenance | ||
| migrations | ||
| scripts | ||
| seeds |