Skip to content

Commit 90cac37

Browse files
committed
Added handling for account-exists-with-different-credential error
1 parent 0e0551a commit 90cac37

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

components/EditProfilePage/PhoneVerificationModal.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ import { useTranslation } from "next-i18next"
1717
const US_REGEX = /^(\([2-9][0-9]{2}\)|[2-9][0-9]{2})[- ]?([0-9]{3})[- ]?([0-9]{4})$/;
1818

1919
const AUTH_ERROR_CODE_TO_KEY: Record<string, string> = {
20-
"auth/credential-already-in-use": "phoneVerification.errors.credentialAlreadyInUse",
20+
"auth/credential-already-in-use":
21+
"phoneVerification.errors.credentialAlreadyInUse",
22+
"auth/account-exists-with-different-credential":
23+
"phoneVerification.errors.credentialAlreadyInUse",
2124
"auth/provider-already-linked": "phoneVerification.errors.providerAlreadyLinked",
2225
"auth/invalid-phone-number": "phoneVerification.errors.invalidPhoneNumber",
2326
"auth/operation-not-allowed": "phoneVerification.errors.operationNotAllowed"

components/auth/hooks.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ const errorMessages: Record<string, string | undefined> = {
2424
"Phone number is not linked to this account. Complete phone verification first.",
2525
"auth/credential-already-in-use":
2626
"This phone number is already linked to another account.",
27+
"auth/account-exists-with-different-credential":
28+
"This phone number is already linked to another account.",
2729
"auth/provider-already-linked":
2830
"This account already has a phone number linked.",
2931
"auth/invalid-phone-number":

0 commit comments

Comments
 (0)