Actions
Sub-Task #184
openEpic #3: Implement a secure user authentication system
Feature #162: Password Recovery
User Story #183: As a user, I want to request a password reset, so that I can recover my account
Generate reset token and send reset email
Sub-Task #184:
Generate reset token and send reset email
Start date:
11/02/2026
Due date:
% Done:
100%
Estimated time:
Description
Server side of the reset request (#183).
Endpoint
POST /api/v1/authentication/forgot-password, body{ email }.- Always answers 202 with a
MessageResponse, whether the account exists or not. - Rate limited: 3 requests per hour per email (lowercased), plus the per-IP login limiter. 429 with
Retry-Afterwhen exceeded.
Flow
- The route publishes a
PasswordResetRequested { email }event and returns. The token never travels on the event bus. - The worker looks the user up by email. It sends a mail only if the account has a password and a verified email; otherwise it does nothing.
- Token: 32 random bytes, base64url. Only its SHA-256 hash is stored.
- Table
password_resets:user_id(PK, FK to users, cascade),token_hash(unique),created_at,expires_at. One row per user: a new request deletes the previous one in the same transaction. - Link:
{base_url}/auth/reset-password#token=...(fragment, not query string). - Template
password_reset.mjml, same layout asemail_verification.mjml. - A failed send returns an error so the bus retries.
Implementation
- New feature
features/password_reset/, same layout asfeatures/email_verification/(db, service, events, event_handlers, mail, error). Handlers registered inworker/register.rs. - Migration and entity through the
db-migrationskill. - OpenAPI response schemas through the
openapi-response-schemaskill.
Tests
- Service: token issued, previous token replaced, no token for unknown email, no password, or unverified email.
- Route: same 202 for known and unknown emails, 429 after the limit.
- Mail: recording sender receives one mail with the link.
Actions