The Security module manages the security state of a user account — email verification, password reset, and two-factor authentication (TOTP). All endpoints are grouped under a single SecurityController at /security. The verify-email and password-reset endpoints are @Public() (no Bearer needed) because they are called before/after login; the 2FA and get-security endpoints require Bearer JWT.
Property
Value
Base URL
{HOST}/v1
Auth
Bearer JWT (header Authorization) or access_token cookie · some endpoints are @Public()
Three main sub-flows: (1) verify email after signup or when an invitation is accepted — an OTP/token is sent to the user’s email; (2) two-step password reset (initiate → confirm); (3) two-step 2FA TOTP (initiate to get a QR code → enable/disable with an authentication code). The GET /security endpoint is used by FE to read the current security status (verified, 2FA on/off, password change required).
Method
Path
Auth
Summary
GET
/v1/security
bearer
Read the security status of the logged-in user
POST
/v1/security/verify-email
public
Verify email + OTP (Public)
PATCH
/v1/security/password-reset
public
Initiate password reset, send OTP to email (Public)
Retrieve a summary of the security status for the logged-in user: whether email has been verified, 2FA is enabled, and whether the password needs to be changed. Used by FE to display a badge / banner on the Settings page.
The two_factor_authentication_secret field is deliberately not sent — its column is select: false on the entity. FE does not need (and is not allowed) to access that secret.
Verify a user’s email via the previously sent OTP. Endpoint is @Public() — callable without Bearer. The email and otp/token parameters can be sent via body or query string; the query string wins if both are sent.
Generate a TOTP secret + QR code data URL for pairing with an authenticator app (Google Authenticator, Authy, etc.). Does not enable 2FA yet — the user must confirm with the enable-2fa endpoint.
The qrcode field is a base64 PNG Data URL — FE can set it directly on <img src=...>. The secret encoded in the QR is stored encrypted on the server and is never sent in plaintext to FE.
Enable or disable 2FA. To enable, the user enters the TOTP code from the authenticator app (result of scanning the QR from initiate-2fa). To disable, set off_two_fa: true — the TOTP code is still required by the DTO but is ignored by the service when off.