diff --git a/registration/src/lib/components/forms/steps/CheckOTPStep.svelte b/registration/src/lib/components/forms/steps/CheckOTPStep.svelte index d64e317..0115058 100644 --- a/registration/src/lib/components/forms/steps/CheckOTPStep.svelte +++ b/registration/src/lib/components/forms/steps/CheckOTPStep.svelte @@ -75,6 +75,13 @@ {$t('entered-code-is-incorrect-try-again')} {/if} + {#if $form?.check_failed} +
+ {$t('otp-check-failed')} +
+ {/if} {#if timeout}
{$t('invalid phone number')}
+ {:else if $form?.send_failed} +
+ {$t('failed-to-send-otp')} +
{:else if phoneTaken}
diff --git a/registration/src/lib/i18n/ar.json b/registration/src/lib/i18n/ar.json index ac15dc1..c7865b0 100644 --- a/registration/src/lib/i18n/ar.json +++ b/registration/src/lib/i18n/ar.json @@ -83,5 +83,7 @@ "set-a-strong-password-with-letters-numbers-and-symbols": "قم بتعيين كلمة مرور قوية مكونة من أحرف وأرقام ورموز", "Faster-and-more-convenient": "أسرع وأكثر ملاءمة", "download-app": "قم بتنزيل تطبيق {name} الجديد", - "Download": "تحميل" + "Download": "تحميل", + "failed-to-send-otp": "فشل إرسال كلمة المرور، يرجى المحاولة مرة أخرى لاحقًا", + "otp-check-failed": "فشل التحقق من كلمة المرور، يرجى محاولة إرسال رمز جديد" } diff --git a/registration/src/lib/i18n/en.json b/registration/src/lib/i18n/en.json index 9104ad8..ce4e45d 100644 --- a/registration/src/lib/i18n/en.json +++ b/registration/src/lib/i18n/en.json @@ -82,5 +82,7 @@ "set-a-strong-password-with-letters-numbers-and-symbols": "Set a strong password with letters, numbers, and symbols", "download-app": "Download the new {name} app", "Faster-and-more-convenient": "Faster and more convenient", - "Download": "Download" + "Download": "Download", + "failed-to-send-otp": "Failed to send OTP, please try again later", + "otp-check-failed": "Failed to check OTP, please try a sending a new code" } diff --git a/registration/src/lib/i18n/fr.json b/registration/src/lib/i18n/fr.json index 47a9a29..0792948 100644 --- a/registration/src/lib/i18n/fr.json +++ b/registration/src/lib/i18n/fr.json @@ -83,5 +83,7 @@ "set-a-strong-password-with-letters-numbers-and-symbols": "Définissez un mot de passe fort avec des lettres, des chiffres et des symboles", "Faster-and-more-convenient": "Plus rapide et plus pratique", "download-app": "Téléchargez la nouvelle application {name}", - "Download": "Télécharger" + "Download": "Télécharger", + "failed-to-send-otp": "Échec de l'envoi d'OTP, veuillez réessayer plus tard", + "otp-check-failed": "Échec de la vérification d'OTP, veuillez essayer d'envoyer un nouveau code" } diff --git a/registration/src/lib/i18n/ru.json b/registration/src/lib/i18n/ru.json index 05f4784..5ae8e8a 100644 --- a/registration/src/lib/i18n/ru.json +++ b/registration/src/lib/i18n/ru.json @@ -83,5 +83,7 @@ "set-a-strong-password-with-letters-numbers-and-symbols": "Установите надежный пароль с буквами, цифрами и символами.", "Faster-and-more-convenient": "Быстрее и удобнее", "download-app": "Загрузите новое приложение {name}", - "Download": "Скачать" + "Download": "Скачать", + "failed-to-send-otp": "Не удалось отправить OTP. Повторите попытку позже.", + "otp-check-failed": "Не удалось проверить OTP. Попробуйте отправить новый код." } diff --git a/registration/src/lib/i18n/vi.json b/registration/src/lib/i18n/vi.json index 707e04f..dd90e56 100644 --- a/registration/src/lib/i18n/vi.json +++ b/registration/src/lib/i18n/vi.json @@ -83,5 +83,7 @@ "set-a-strong-password-with-letters-numbers-and-symbols": "Đặt mật khẩu mạnh bằng chữ cái, số và ký hiệu", "Faster-and-more-convenient": "Nhanh hơn và thuận tiện hơn", "download-app": "Tải xuống ứng dụng {name} mới", - "Download": "Tải xuống" + "Download": "Tải xuống", + "failed-to-send-otp": "Không gửi được OTP, vui lòng thử lại sau", + "otp-check-failed": "Không kiểm tra được OTP, vui lòng thử gửi mã mới" } diff --git a/registration/src/lib/services/otp/index.ts b/registration/src/lib/services/otp/index.ts index a6850cd..d1c08e5 100644 --- a/registration/src/lib/services/otp/index.ts +++ b/registration/src/lib/services/otp/index.ts @@ -102,6 +102,10 @@ export const verify = async ( return 'wrong'; } + if (json.code === 198) { + throw Error('OTP Request not found'); + } + return 'timeout'; } catch (error) { logger.error(`Failed to verify OTP for ${phone}`, error); diff --git a/registration/src/routes/+page.server.ts b/registration/src/routes/+page.server.ts index 73c3d2a..7c7a853 100644 --- a/registration/src/routes/+page.server.ts +++ b/registration/src/routes/+page.server.ts @@ -167,7 +167,7 @@ export const actions: Actions = { } catch (error) { logger.error(`error sending OTP to ${data.phone}`, error); - return fail(400, { message: 'Failed to send OTP' }); + return fail(400, { message: 'Failed to send OTP', send_failed: true }); } }, @@ -247,7 +247,7 @@ export const actions: Actions = { } catch (error) { logger.error(`error checking OTP for ${session.data.phone}`, error); - return fail(400, { message: 'Failed to check OTP' }); + return fail(400, { message: 'Failed to check OTP', check_failed: true }); } },