From 6f228a598e5cf5c445dc255c608d3164b2a7b853 Mon Sep 17 00:00:00 2001 From: RonyVidaur Date: Sat, 3 Feb 2024 21:54:37 -0600 Subject: [PATCH 1/3] validate phone number based on country --- src/view/com/auth/create/Step2.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/view/com/auth/create/Step2.tsx b/src/view/com/auth/create/Step2.tsx index 6005ee3a..626ff0e8 100644 --- a/src/view/com/auth/create/Step2.tsx +++ b/src/view/com/auth/create/Step2.tsx @@ -42,10 +42,11 @@ export function Step2({ const {isMobile} = useWebMediaQueries() const onPressRequest = React.useCallback(() => { - if ( - uiState.verificationPhone.length >= 9 && - parsePhoneNumber(uiState.verificationPhone, uiState.phoneCountry) - ) { + const phoneNumber = parsePhoneNumber( + uiState.verificationPhone, + uiState.phoneCountry, + ); + if (phoneNumber.isValid()) { requestVerificationCode({uiState, uiDispatch, _}) } else { uiDispatch({ From 323b5bdfda426ac2f2366ff1f36031092f843e75 Mon Sep 17 00:00:00 2001 From: RonyVidaur Date: Sat, 3 Feb 2024 22:09:07 -0600 Subject: [PATCH 2/3] enhance check --- src/view/com/auth/create/Step2.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/view/com/auth/create/Step2.tsx b/src/view/com/auth/create/Step2.tsx index 626ff0e8..4e6512c9 100644 --- a/src/view/com/auth/create/Step2.tsx +++ b/src/view/com/auth/create/Step2.tsx @@ -46,7 +46,7 @@ export function Step2({ uiState.verificationPhone, uiState.phoneCountry, ); - if (phoneNumber.isValid()) { + if (phoneNumber && phoneNumber.isValid()) { requestVerificationCode({uiState, uiDispatch, _}) } else { uiDispatch({ From 1412f9d95cfa5de31a80f279095618f84982705e Mon Sep 17 00:00:00 2001 From: RonyVidaur Date: Sat, 3 Feb 2024 22:27:50 -0600 Subject: [PATCH 3/3] format --- src/view/com/auth/create/Step2.tsx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/view/com/auth/create/Step2.tsx b/src/view/com/auth/create/Step2.tsx index 4e6512c9..c1648ecc 100644 --- a/src/view/com/auth/create/Step2.tsx +++ b/src/view/com/auth/create/Step2.tsx @@ -42,10 +42,7 @@ export function Step2({ const {isMobile} = useWebMediaQueries() const onPressRequest = React.useCallback(() => { - const phoneNumber = parsePhoneNumber( - uiState.verificationPhone, - uiState.phoneCountry, - ); + const phoneNumber = parsePhoneNumber(uiState.verificationPhone, uiState.phoneCountry) if (phoneNumber && phoneNumber.isValid()) { requestVerificationCode({uiState, uiDispatch, _}) } else {