Files
vitareba/app/api/auth
GandClaude Fable 5 6c530594f8 fix(auth): honest email-failure handling — no more silent password-reset lockout (#21)
An unconfigured or failing email provider used to be invisible: forgot-
password answered "sent" with nothing sent (permanent lockout for the
user), cron marked queued emails as delivered, and reset-password errors
surfaced as raw English strings on localized pages. Now:

- lib/email: sendEmail never throws, returns { sent } | { sent, error },
  checks the Resend SDK's error return (it doesn't throw); new
  isEmailConfigured() gate.
- /api/auth/forgot-password: 503 with a translated "contact us at
  {email}" message when the provider is unconfigured — checked before
  any user lookup, so no account enumeration.
- /api/auth/reset-password: machine-readable error codes; the page maps
  invalid_token to a localized message plus a "request a new link"
  recovery action instead of echoing API English.
- cron-emails: unconfigured provider leaves the queue pending (retried
  next run); a provider send error marks the row failed instead of sent.
- messages/{de,en,fr,it}: unavailable + expiredError keys.

Verified in-browser at 390px and 1280px: forgot-password honest 503,
reset flow with bad token shows localized error + recovery link.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 11:19:32 +00:00
..