This commit is contained in:
Untone 2024-02-08 21:36:05 +03:00
parent 083d421cc5
commit 29d807343f
3 changed files with 18 additions and 6 deletions

View File

@ -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 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 message": "Write a message",
"Write to us": "Write to us", "Write to us": "Write to us",
"You can": "You can",
"Write your colleagues name or email": "Write your colleague's name or email", "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 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": "Теперь вы можете входить с помощью нового пароля", "You can now login using your new password": "Теперь вы можете входить с помощью нового пароля",

View File

@ -464,6 +464,7 @@
"Write message": "Написать сообщение", "Write message": "Написать сообщение",
"Write to us": "Напишите нам", "Write to us": "Напишите нам",
"Write your colleagues name or email": "Напишите имя или e-mail коллеги", "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 download multiple tracks at once in .mp3, .wav or .flac formats": "Можно загрузить сразу несколько треков в форматах .mp3, .wav или .flac",
"You can now login using your new password": "Теперь вы можете входить с помощью нового пароля", "You can now login using your new password": "Теперь вы можете входить с помощью нового пароля",
"You was successfully authorized": "Вы были успешно авторизованы", "You was successfully authorized": "Вы были успешно авторизованы",

View File

@ -15,6 +15,7 @@ import { PasswordField } from './PasswordField'
import { SocialProviders } from './SocialProviders' import { SocialProviders } from './SocialProviders'
import { email, setEmail } from './sharedLogic' import { email, setEmail } from './sharedLogic'
import { GenericResponse } from '@authorizerdev/authorizer-js'
import styles from './AuthModal.module.scss' import styles from './AuthModal.module.scss'
type EmailStatus = 'not verified' | 'verified' | 'registered' | '' 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) => { const handleCheckEmailStatus = (status: EmailStatus | string) => {
switch (status) { switch (status) {
case 'not verified': case 'not verified':
@ -118,10 +127,7 @@ export const RegisterForm = () => {
email: ( email: (
<> <>
{t('This email is not verified')},{' '} {t('This email is not verified')},{' '}
<span <span class="link" onClick={handleResendLink}>
class="link"
onClick={() => resendVerifyEmail({ email: email(), identifier: 'basic_signup' })}
>
{t('resend confirmation link')} {t('resend confirmation link')}
</span> </span>
</> </>
@ -133,10 +139,14 @@ export const RegisterForm = () => {
setValidationErrors((prev) => ({ setValidationErrors((prev) => ({
email: ( email: (
<> <>
{t('This email is verified')},{' '} {t('This email is verified')}. {t('You can')}
<span class="link" onClick={() => changeSearchParams({ mode: 'login' })}> <span class="link" onClick={() => changeSearchParams({ mode: 'login' })}>
{t('enter')} {t('enter')}
</span> </span>
{t('or')}{' '}
<span class="link" onClick={() => changeSearchParams({ mode: 'send-reset-link' })}>
{t('Set the new password').toLocaleLowerCase()}
</span>
</> </>
), ),
})) }))
@ -146,7 +156,7 @@ export const RegisterForm = () => {
...prev, ...prev,
email: ( email: (
<> <>
{t('This email is registered')},{'. '} {t('This email is registered')}. {t('You can')}{' '}
<span class="link" onClick={() => changeSearchParams({ mode: 'send-reset-link' })}> <span class="link" onClick={() => changeSearchParams({ mode: 'send-reset-link' })}>
{t('Set the new password').toLocaleLowerCase()} {t('Set the new password').toLocaleLowerCase()}
</span> </span>