Skip to content

Commit d583051

Browse files
authored
fix(account-center): auto-submit when 6-digit verification code is complete (#8089)
1 parent 53a4104 commit d583051

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

packages/account-center/src/pages/CodeFlow/IdentifierVerifyStep.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,14 @@ const IdentifierVerifyStep = ({
7070
setCountdown(resendCooldownSeconds);
7171
}, [verificationRecordId, resetSignal]);
7272

73+
// Auto-submit when all 6 digits are entered
74+
useEffect(() => {
75+
if (!isCodeReady) {
76+
return;
77+
}
78+
onSubmit(codeInput.join(''));
79+
}, [codeInput, isCodeReady, onSubmit]);
80+
7381
useEffect(() => {
7482
if (typeof window === 'undefined' || countdown <= 0) {
7583
return;

packages/account-center/src/pages/TotpBinding/index.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,14 @@ const TotpBinding = () => {
167167
]
168168
);
169169

170+
// Auto-submit when all 6 digits are entered
171+
useEffect(() => {
172+
if (!isCodeReady(codeInput)) {
173+
return;
174+
}
175+
void handleSubmit();
176+
}, [codeInput, handleSubmit]);
177+
170178
if (
171179
!accountCenterSettings?.enabled ||
172180
accountCenterSettings.fields.mfa !== AccountCenterControlValue.Edit

0 commit comments

Comments
 (0)