fix(auth): a new email address on an account with a second factor needs that factor

The address is what single sign-on links an existing account by, and
changing it took the password or a session younger than five minutes on
every account. A remembered browser skips the second factor at sign-in and
still makes a fresh session, so the password alone could move the address
of an account the second factor was meant to protect.

On an account with a second factor only a second factor or passkey
completed in the last five minutes counts now; the password is not
checked. The refusal names it (second_factor_required in rejectedFields,
or 401 profile.update.emailSecondFactorRequired when the address was all
that changed), and the profile form opens the re-proof dialog with the
factors the account holds, then saves again, no longer offering the
password field. Accounts without a second factor keep the password or a
recent sign-in. A token cannot change the address of such an account;
the app does not change it.
This commit is contained in:
Marc-André Bombeck committed 2026-09-27 00:59:06 +02:00
1 parent bd270d635a
commit 9642c749c9
16 files changed
+280 -61

No files matched your search

+1
View File
@@ -290,6 +290,7 @@ export const ERROR_CODE_CATALOGUE: Readonly<Record<string, readonly string[]>> =
profile: [
"profile.update.emailInUse",
"profile.update.emailRateLimited",
"profile.update.emailSecondFactorRequired",
"profile.update.invalidBody",
"profile.update.nothingSaved",
],