fix: handle MFA binding skip during registration submit
The registration flow hit a 422 on /api/experience/submit when MFA policy is UserControlled. Adds the same trySubmit + skipMfaBinding pattern already used in the sign-in flow — Logto confirms mfa-skipped works for both SignIn and Register interaction events. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -180,7 +180,19 @@ export async function completeRegistration(
|
|||||||
const verifiedId = await verifyCode(email, verificationId, code);
|
const verifiedId = await verifyCode(email, verificationId, code);
|
||||||
await addProfile('password', password);
|
await addProfile('password', password);
|
||||||
await identifyUser(verifiedId);
|
await identifyUser(verifiedId);
|
||||||
return submitInteraction();
|
|
||||||
|
const result = await trySubmit();
|
||||||
|
if (result.ok) return result.redirectTo;
|
||||||
|
|
||||||
|
// MFA not enrolled, UserControlled policy — skip the binding prompt
|
||||||
|
if (result.status === 422 && result.code.includes('mfa')) {
|
||||||
|
await skipMfaBinding();
|
||||||
|
const retry = await trySubmit();
|
||||||
|
if (retry.ok) return retry.redirectTo;
|
||||||
|
throw new Error(retry.message);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Error(result.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Forgot Password ---
|
// --- Forgot Password ---
|
||||||
|
|||||||
Reference in New Issue
Block a user