@@ -43,17 +43,22 @@ export function MFATheme(props: WebAuthnMFAProps): JSX.Element {
4343 const t = useTranslation ( ) ;
4444
4545 const onRegisterPasskeyClick = React . useCallback ( ( ) => {
46+ if ( ! props . featureState . canRegisterPasskey ) return ;
4647 if ( props . featureState . email ) {
4748 setActiveScreen ( MFAScreens . SignUpConfirmation ) ;
4849 } else {
4950 setActiveScreen ( MFAScreens . SignUp ) ;
5051 }
51- } , [ props . featureState . email ] ) ;
52+ } , [ props . featureState . email , props . featureState . canRegisterPasskey ] ) ;
5253
53- const onSignUpContinue = React . useCallback ( ( email : string ) => {
54- setActiveScreen ( MFAScreens . SignUpConfirmation ) ;
55- setSignUpEmail ( email ) ;
56- } , [ ] ) ;
54+ const onSignUpContinue = React . useCallback (
55+ ( email : string ) => {
56+ if ( ! props . featureState . canRegisterPasskey ) return ;
57+ setActiveScreen ( MFAScreens . SignUpConfirmation ) ;
58+ setSignUpEmail ( email ) ;
59+ } ,
60+ [ props . featureState . canRegisterPasskey ]
61+ ) ;
5762
5863 const clearError = React . useCallback ( ( ) => {
5964 props . dispatch ( { type : "setError" , error : undefined } ) ;
@@ -67,8 +72,9 @@ export function MFATheme(props: WebAuthnMFAProps): JSX.Element {
6772 ) ;
6873
6974 const onClickSignUpBackButton = React . useCallback ( ( ) => {
75+ if ( ! props . featureState . canRegisterPasskey ) return ;
7076 setActiveScreen ( MFAScreens . SignIn ) ;
71- } , [ ] ) ;
77+ } , [ props . featureState . canRegisterPasskey ] ) ;
7278
7379 const onClickSignUpConfirmationBackButton = React . useCallback ( ( ) => {
7480 if ( props . featureState . email ) {
@@ -101,6 +107,7 @@ export function MFATheme(props: WebAuthnMFAProps): JSX.Element {
101107 { activeScreen === MFAScreens . SignIn ? (
102108 < WebauthnMFASignIn
103109 onBackButtonClicked = { props . featureState . showBackButton ? onBackButtonClicked : undefined }
110+ canRegisterPasskey = { props . featureState . canRegisterPasskey }
104111 onSignIn = { onSignIn }
105112 error = { props . featureState . error }
106113 onRegisterPasskeyClick = { onRegisterPasskeyClick }
0 commit comments