Files
ServerKit/backend/app/api
Juan Denis 9bb3672551 Reuse the pending 2FA setup secret
initiate_setup minted and committed a new secret on every call, so a
second Enable click, a double-click or reopening the setup window threw
away the secret the user had just scanned and the authenticator's code
never verified.

Reuse the unconfirmed secret unless none exists or the caller sends
{"regenerate": true}. The user row is locked for the call so concurrent
/auth/2fa/setup requests cannot both invent a secret. Confirmed users
still get 400 and are never rotated. TOTP parameters are unchanged.

Tests cover reuse, confirm with the reused secret, regenerate, the 400
for confirmed users, and the QR being built from the otpauth URI.
2026-11-26 02:38:47 -05:00
..
2026-10-10 20:53:43 -04:00
2026-10-10 20:53:43 -04:00
2026-10-03 22:46:54 -04:00
2026-10-10 20:53:43 -04:00