Skip to content

Commit d51fee6

Browse files
authored
Make backing up page work on firefox (#899)
1 parent f839300 commit d51fee6

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

packages/app/features/auth/sign-up/sign-up-form.tsx

+8-4
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ enum PageState {
3535
BackUpPrompt = 'BackUpPrompt',
3636
}
3737

38+
const WEBKIT_CANCEL_PASSKEY_PROMPT_ERROR_NAME = 'NotAllowedError'
39+
const FIREFOX_CANCEL_PASSKEY_PROMPT_ERROR_NAME = 'AbortError'
40+
3841
export const SignUpForm = () => {
3942
const form = useForm<z.infer<typeof SignUpSchema>>()
4043
const router = useRouter()
@@ -85,11 +88,12 @@ export const SignUpForm = () => {
8588

8689
router.push(redirectUri ?? '/')
8790
} catch (error) {
88-
if (
89-
isPhoneAlreadyUsed &&
91+
const wasPasskeyPromptCanceled =
9092
error.constructor.name === 'DOMException' &&
91-
error.name === 'NotAllowedError'
92-
) {
93+
(error.name === WEBKIT_CANCEL_PASSKEY_PROMPT_ERROR_NAME ||
94+
error.name === FIREFOX_CANCEL_PASSKEY_PROMPT_ERROR_NAME)
95+
96+
if (isPhoneAlreadyUsed && wasPasskeyPromptCanceled) {
9397
setPageState(PageState.BackUpPrompt)
9498
return
9599
}

0 commit comments

Comments
 (0)