From 29d807343f2eb8e54f4b0f90a0720a60c3de4ace Mon Sep 17 00:00:00 2001 From: Untone Date: Thu, 8 Feb 2024 21:36:05 +0300 Subject: [PATCH] variants --- public/locales/en/translation.json | 1 + public/locales/ru/translation.json | 1 + src/components/Nav/AuthModal/RegisterForm.tsx | 22 ++++++++++++++----- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json index f4427991..637181ee 100644 --- a/public/locales/en/translation.json +++ b/public/locales/en/translation.json @@ -440,6 +440,7 @@ "Write good articles, comment\nand it won't be so empty here": "Write good articles, comment\nand it won't be so empty here", "Write message": "Write a message", "Write to us": "Write to us", + "You can": "You can", "Write your colleagues name or email": "Write your colleague's name or email", "You can download multiple tracks at once in .mp3, .wav or .flac formats": "You can download multiple tracks at once in .mp3, .wav or .flac formats", "You can now login using your new password": "Теперь вы можете входить с помощью нового пароля", diff --git a/public/locales/ru/translation.json b/public/locales/ru/translation.json index febefff4..a133a152 100644 --- a/public/locales/ru/translation.json +++ b/public/locales/ru/translation.json @@ -464,6 +464,7 @@ "Write message": "Написать сообщение", "Write to us": "Напишите нам", "Write your colleagues name or email": "Напишите имя или e-mail коллеги", + "You can": "Вы можете", "You can download multiple tracks at once in .mp3, .wav or .flac formats": "Можно загрузить сразу несколько треков в форматах .mp3, .wav или .flac", "You can now login using your new password": "Теперь вы можете входить с помощью нового пароля", "You was successfully authorized": "Вы были успешно авторизованы", diff --git a/src/components/Nav/AuthModal/RegisterForm.tsx b/src/components/Nav/AuthModal/RegisterForm.tsx index af49ab67..bd1e6c46 100644 --- a/src/components/Nav/AuthModal/RegisterForm.tsx +++ b/src/components/Nav/AuthModal/RegisterForm.tsx @@ -15,6 +15,7 @@ import { PasswordField } from './PasswordField' import { SocialProviders } from './SocialProviders' import { email, setEmail } from './sharedLogic' +import { GenericResponse } from '@authorizerdev/authorizer-js' import styles from './AuthModal.module.scss' type EmailStatus = 'not verified' | 'verified' | 'registered' | '' @@ -110,6 +111,14 @@ export const RegisterForm = () => { } } + const handleResendLink = async (_ev) => { + const response: GenericResponse = await resendVerifyEmail({ + email: email(), + identifier: 'basic_signup', + }) + setIsSuccess(response?.message === 'Verification email has been sent. Please check your inbox') + } + const handleCheckEmailStatus = (status: EmailStatus | string) => { switch (status) { case 'not verified': @@ -118,10 +127,7 @@ export const RegisterForm = () => { email: ( <> {t('This email is not verified')},{' '} - resendVerifyEmail({ email: email(), identifier: 'basic_signup' })} - > + {t('resend confirmation link')} @@ -133,10 +139,14 @@ export const RegisterForm = () => { setValidationErrors((prev) => ({ email: ( <> - {t('This email is verified')},{' '} + {t('This email is verified')}. {t('You can')} changeSearchParams({ mode: 'login' })}> {t('enter')} + {t('or')}{' '} + changeSearchParams({ mode: 'send-reset-link' })}> + {t('Set the new password').toLocaleLowerCase()} + ), })) @@ -146,7 +156,7 @@ export const RegisterForm = () => { ...prev, email: ( <> - {t('This email is registered')},{'. '} + {t('This email is registered')}. {t('You can')}{' '} changeSearchParams({ mode: 'send-reset-link' })}> {t('Set the new password').toLocaleLowerCase()}