@@ -12,34 +12,30 @@ import {
1212 createWebAuthnRegistration ,
1313 verifyWebAuthnRegistration ,
1414 addWebAuthnMfa ,
15- getMfaVerifications ,
1615} from '@ac/apis/mfa' ;
1716import ErrorPage from '@ac/components/ErrorPage' ;
1817import VerificationMethodList from '@ac/components/VerificationMethodList' ;
19- import { backupCodesGenerateRoute , passkeySuccessRoute } from '@ac/constants/routes' ;
18+ import { passkeySuccessRoute } from '@ac/constants/routes' ;
2019import useApi from '@ac/hooks/use-api' ;
2120import useErrorHandler from '@ac/hooks/use-error-handler' ;
2221import SecondaryPageLayout from '@ac/layouts/SecondaryPageLayout' ;
2322
2423import styles from './index.module.scss' ;
2524
2625const isWebAuthnEnabled = ( mfa ?: Mfa ) => mfa ?. factors . includes ( MfaFactor . WebAuthn ) ?? false ;
27- const isBackupCodeEnabled = ( mfa ?: Mfa ) => mfa ?. factors . includes ( MfaFactor . BackupCode ) ?? false ;
2826
2927const PasskeyBinding = ( ) => {
3028 const { t } = useTranslation ( ) ;
3129 const navigate = useNavigate ( ) ;
3230 const { loading } = useContext ( LoadingContext ) ;
3331 const { accountCenterSettings, experienceSettings, verificationId, setVerificationId, setToast } =
3432 useContext ( PageContext ) ;
35- const getMfaRequest = useApi ( getMfaVerifications ) ;
3633 const createRegistrationRequest = useApi ( createWebAuthnRegistration ) ;
3734 const verifyRegistrationRequest = useApi ( verifyWebAuthnRegistration ) ;
3835 const addWebAuthnRequest = useApi ( addWebAuthnMfa ) ;
3936 const handleError = useErrorHandler ( ) ;
4037
4138 const [ isWebAuthnSupported , setIsWebAuthnSupported ] = useState < boolean > ( ) ;
42- const [ hasBackupCodes , setHasBackupCodes ] = useState < boolean > ( ) ;
4339 // Pre-fetched WebAuthn registration options to ensure startRegistration() is called
4440 // synchronously in the click handler (required for iOS Safari/WKWebView user gesture)
4541 const [ registrationData , setRegistrationData ] = useState < {
@@ -75,23 +71,6 @@ const PasskeyBinding = () => {
7571 void fetchRegistrationOptions ( ) ;
7672 } , [ verificationId , createRegistrationRequest ] ) ;
7773
78- // Check if user has backup codes
79- useEffect ( ( ) => {
80- const checkExistingMfa = async ( ) => {
81- const [ error , result ] = await getMfaRequest ( ) ;
82-
83- if ( error ) {
84- setHasBackupCodes ( false ) ;
85- return ;
86- }
87-
88- const hasBackup = result ?. some ( ( mfa ) => mfa . type === MfaFactor . BackupCode ) ?? false ;
89- setHasBackupCodes ( hasBackup ) ;
90- } ;
91-
92- void checkExistingMfa ( ) ;
93- } , [ getMfaRequest ] ) ;
94-
9574 const handleAddPasskey = useCallback ( async ( ) => {
9675 if ( ! verificationId || loading || ! registrationData ) {
9776 return ;
@@ -143,18 +122,10 @@ const PasskeyBinding = () => {
143122 return ;
144123 }
145124
146- // Step 4: Navigate to success or backup code setup
147- if ( isBackupCodeEnabled ( experienceSettings ?. mfa ) && ! hasBackupCodes ) {
148- void navigate ( backupCodesGenerateRoute , { replace : true } ) ;
149- return ;
150- }
151-
152125 void navigate ( passkeySuccessRoute , { replace : true } ) ;
153126 } , [
154127 addWebAuthnRequest ,
155- experienceSettings ?. mfa ,
156128 handleError ,
157- hasBackupCodes ,
158129 loading ,
159130 navigate ,
160131 registrationData ,
0 commit comments