refactored
This commit is contained in:
parent
bafe35cb0e
commit
a664c8f6cb
|
@ -143,7 +143,7 @@
|
||||||
"Enter your new password": "Enter your new password",
|
"Enter your new password": "Enter your new password",
|
||||||
"Enter": "Enter",
|
"Enter": "Enter",
|
||||||
"Error": "Error",
|
"Error": "Error",
|
||||||
"Everything is ok, please give us your email address": "It's okay, just enter your email address to receive a password reset link.",
|
"Please give us your email address": "Please provide us your email address to get the password reset link",
|
||||||
"Experience": "Experience",
|
"Experience": "Experience",
|
||||||
"FAQ": "Tips and suggestions",
|
"FAQ": "Tips and suggestions",
|
||||||
"Favorite topics": "Favorite topics",
|
"Favorite topics": "Favorite topics",
|
||||||
|
@ -157,7 +157,6 @@
|
||||||
"Follow": "Follow",
|
"Follow": "Follow",
|
||||||
"Followers": "Followers",
|
"Followers": "Followers",
|
||||||
"Following": "Following",
|
"Following": "Following",
|
||||||
"Forgot password?": "Forgot your password?",
|
|
||||||
"Forward": "Forward",
|
"Forward": "Forward",
|
||||||
"Full name": "First and last name",
|
"Full name": "First and last name",
|
||||||
"Gallery name": "Gallery name",
|
"Gallery name": "Gallery name",
|
||||||
|
@ -308,7 +307,6 @@
|
||||||
"Reports": "Reports",
|
"Reports": "Reports",
|
||||||
"Required": "Required",
|
"Required": "Required",
|
||||||
"Resend code": "Send confirmation",
|
"Resend code": "Send confirmation",
|
||||||
"Restore password": "Restore password",
|
|
||||||
"Rules of the journal Discours": "Rules of the journal Discours",
|
"Rules of the journal Discours": "Rules of the journal Discours",
|
||||||
"Save draft": "Save draft",
|
"Save draft": "Save draft",
|
||||||
"Save settings": "Save settings",
|
"Save settings": "Save settings",
|
||||||
|
|
|
@ -150,7 +150,7 @@
|
||||||
"Enter your new password": "Введите новый пароль",
|
"Enter your new password": "Введите новый пароль",
|
||||||
"Enter": "Войти",
|
"Enter": "Войти",
|
||||||
"Error": "Ошибка",
|
"Error": "Ошибка",
|
||||||
"Everything is ok, please give us your email address": "Ничего страшного, просто укажите свою почту, чтобы получить ссылку для сброса пароля.",
|
"Please give us your email address": "Пожалуйста, укажите свою почту, чтобы получить ссылку для сброса пароля",
|
||||||
"Experience": "Личный опыт",
|
"Experience": "Личный опыт",
|
||||||
"FAQ": "Советы и предложения",
|
"FAQ": "Советы и предложения",
|
||||||
"Favorite topics": "Избранные темы",
|
"Favorite topics": "Избранные темы",
|
||||||
|
@ -164,7 +164,6 @@
|
||||||
"Follow": "Подписаться",
|
"Follow": "Подписаться",
|
||||||
"Followers": "Подписчики",
|
"Followers": "Подписчики",
|
||||||
"Following": "Вы подписаны",
|
"Following": "Вы подписаны",
|
||||||
"Forgot password?": "Забыли пароль?",
|
|
||||||
"Forward": "Переслать",
|
"Forward": "Переслать",
|
||||||
"Full name": "Имя и фамилия",
|
"Full name": "Имя и фамилия",
|
||||||
"Gallery name": "Название галереи",
|
"Gallery name": "Название галереи",
|
||||||
|
@ -327,7 +326,7 @@
|
||||||
"Reports": "Репортажи",
|
"Reports": "Репортажи",
|
||||||
"Required": "Поле обязательно для заполнения",
|
"Required": "Поле обязательно для заполнения",
|
||||||
"Resend code": "Выслать подтверждение",
|
"Resend code": "Выслать подтверждение",
|
||||||
"Restore password": "Восстановить пароль",
|
"Set the new password": "Задать новый пароль",
|
||||||
"Rules of the journal Discours": "Правила журнала Дискурс",
|
"Rules of the journal Discours": "Правила журнала Дискурс",
|
||||||
"Save draft": "Сохранить черновик",
|
"Save draft": "Сохранить черновик",
|
||||||
"Save settings": "Сохранить настройки",
|
"Save settings": "Сохранить настройки",
|
||||||
|
@ -343,7 +342,6 @@
|
||||||
"Self-publishing exists thanks to the help of wonderful people from all over the world. Thank you!": "Самиздат существуют благодаря помощи замечательных людей со всего мира. Спасибо Вам!",
|
"Self-publishing exists thanks to the help of wonderful people from all over the world. Thank you!": "Самиздат существуют благодаря помощи замечательных людей со всего мира. Спасибо Вам!",
|
||||||
"Send link again": "Прислать ссылку ещё раз",
|
"Send link again": "Прислать ссылку ещё раз",
|
||||||
"Send": "Отправить",
|
"Send": "Отправить",
|
||||||
"Set the new password": "Задать новый пароль",
|
|
||||||
"Settings": "Настройки",
|
"Settings": "Настройки",
|
||||||
"Share publication": "Поделиться публикацией",
|
"Share publication": "Поделиться публикацией",
|
||||||
"Share": "Поделиться",
|
"Share": "Поделиться",
|
||||||
|
|
|
@ -55,7 +55,7 @@ export const LoginForm = () => {
|
||||||
setIsLinkSent(true)
|
setIsLinkSent(true)
|
||||||
setIsEmailNotConfirmed(false)
|
setIsEmailNotConfirmed(false)
|
||||||
setSubmitError('')
|
setSubmitError('')
|
||||||
changeSearchParams({ mode: 'forgot-password' })
|
changeSearchParams({ mode: 'send-reset-link' })
|
||||||
// NOTE: temporary solution, needs logic in authorizer
|
// NOTE: temporary solution, needs logic in authorizer
|
||||||
/* FIXME:
|
/* FIXME:
|
||||||
const { authorizer } = useSession()
|
const { authorizer } = useSession()
|
||||||
|
@ -172,7 +172,7 @@ export const LoginForm = () => {
|
||||||
class="link"
|
class="link"
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
changeSearchParams({
|
changeSearchParams({
|
||||||
mode: 'forgot-password',
|
mode: 'send-reset-link',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
|
|
@ -187,17 +187,16 @@ export const RegisterForm = () => {
|
||||||
onBlur={handleEmailBlur}
|
onBlur={handleEmailBlur}
|
||||||
/>
|
/>
|
||||||
<label for="email">{t('Email')}</label>
|
<label for="email">{t('Email')}</label>
|
||||||
|
|
||||||
<div class={styles.validationError}>{validationErrors().email}</div>
|
<div class={styles.validationError}>{validationErrors().email}</div>
|
||||||
|
<Show when={Boolean(emailStatus())}>
|
||||||
|
{t('This email is')} {emailStatus() ? t(emailStatus()) : ''},{' '}
|
||||||
|
</Show>
|
||||||
<Show when={emailStatus() === 'verfied'}>
|
<Show when={emailStatus() === 'verfied'}>
|
||||||
{t('This email is')} {t(emailStatus())},{' '}
|
|
||||||
<span class="link" onClick={() => changeSearchParams({ mode: 'login' })}>
|
<span class="link" onClick={() => changeSearchParams({ mode: 'login' })}>
|
||||||
{t('enter')}
|
{t('enter')}
|
||||||
</span>
|
</span>
|
||||||
</Show>
|
</Show>
|
||||||
<Show when={emailStatus() === 'not verfied'}>
|
<Show when={emailStatus() === 'not verfied'}>
|
||||||
{t('This email is')} {t(emailStatus())},{' '}
|
|
||||||
<span
|
<span
|
||||||
class="link"
|
class="link"
|
||||||
onClick={() => resendVerifyEmail({ email: email(), identifier: 'basic_signup' })}
|
onClick={() => resendVerifyEmail({ email: email(), identifier: 'basic_signup' })}
|
||||||
|
@ -206,12 +205,11 @@ export const RegisterForm = () => {
|
||||||
</span>
|
</span>
|
||||||
</Show>
|
</Show>
|
||||||
<Show when={emailStatus() === 'registered'}>
|
<Show when={emailStatus() === 'registered'}>
|
||||||
{t('This email is')} {t(emailStatus())},{' '}
|
|
||||||
<span
|
<span
|
||||||
class="link"
|
class="link"
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
changeSearchParams({
|
changeSearchParams({
|
||||||
mode: 'forgot-password',
|
mode: 'send-reset-link',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
|
|
@ -18,7 +18,7 @@ type FormFields = {
|
||||||
|
|
||||||
type ValidationErrors = Partial<Record<keyof FormFields, string | JSX.Element>>
|
type ValidationErrors = Partial<Record<keyof FormFields, string | JSX.Element>>
|
||||||
|
|
||||||
export const ForgotPasswordForm = () => {
|
export const SendResetLinkForm = () => {
|
||||||
const { changeSearchParams } = useRouter<AuthModalSearchParams>()
|
const { changeSearchParams } = useRouter<AuthModalSearchParams>()
|
||||||
const { t } = useLocalize()
|
const { t } = useLocalize()
|
||||||
const handleEmailInput = (newEmail: string) => {
|
const handleEmailInput = (newEmail: string) => {
|
||||||
|
@ -60,7 +60,7 @@ export const ForgotPasswordForm = () => {
|
||||||
email: email(),
|
email: email(),
|
||||||
redirect_uri: window.location.origin,
|
redirect_uri: window.location.origin,
|
||||||
})
|
})
|
||||||
console.debug('[ForgotPasswordForm] authorizer response:', data)
|
console.debug('[SendResetLinkForm] authorizer response:', data)
|
||||||
if (errors?.some((error) => error.message.includes('bad user credentials'))) {
|
if (errors?.some((error) => error.message.includes('bad user credentials'))) {
|
||||||
setIsUserNotFound(true)
|
setIsUserNotFound(true)
|
||||||
}
|
}
|
||||||
|
@ -79,10 +79,8 @@ export const ForgotPasswordForm = () => {
|
||||||
ref={(el) => (authFormRef.current = el)}
|
ref={(el) => (authFormRef.current = el)}
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<h4>{t('Restore password')}</h4>
|
<h4>{t('Set the new password')}</h4>
|
||||||
<div class={styles.authSubtitle}>
|
<div class={styles.authSubtitle}>{t(message()) || t('Please give us your email address')}</div>
|
||||||
{t(message()) || t('Everything is ok, please give us your email address')}
|
|
||||||
</div>
|
|
||||||
<div
|
<div
|
||||||
class={clsx('pretty-form__item', {
|
class={clsx('pretty-form__item', {
|
||||||
'pretty-form__item--error': validationErrors().email,
|
'pretty-form__item--error': validationErrors().email,
|
||||||
|
@ -126,7 +124,7 @@ export const ForgotPasswordForm = () => {
|
||||||
disabled={isSubmitting() || Boolean(message())}
|
disabled={isSubmitting() || Boolean(message())}
|
||||||
type="submit"
|
type="submit"
|
||||||
>
|
>
|
||||||
{isSubmitting() ? '...' : t('Restore password')}
|
{isSubmitting() ? '...' : t('Send')}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class={styles.authControl}>
|
<div class={styles.authControl}>
|
|
@ -11,16 +11,16 @@ import { isMobile } from '../../../utils/media-query'
|
||||||
|
|
||||||
import { ChangePasswordForm } from './ChangePasswordForm'
|
import { ChangePasswordForm } from './ChangePasswordForm'
|
||||||
import { EmailConfirm } from './EmailConfirm'
|
import { EmailConfirm } from './EmailConfirm'
|
||||||
import { ForgotPasswordForm } from './ForgotPasswordForm'
|
|
||||||
import { LoginForm } from './LoginForm'
|
import { LoginForm } from './LoginForm'
|
||||||
import { RegisterForm } from './RegisterForm'
|
import { RegisterForm } from './RegisterForm'
|
||||||
|
import { SendResetLinkForm } from './SendResetLinkForm'
|
||||||
|
|
||||||
import styles from './AuthModal.module.scss'
|
import styles from './AuthModal.module.scss'
|
||||||
|
|
||||||
const AUTH_MODAL_MODES: Record<AuthModalMode, Component> = {
|
const AUTH_MODAL_MODES: Record<AuthModalMode, Component> = {
|
||||||
login: LoginForm,
|
login: LoginForm,
|
||||||
register: RegisterForm,
|
register: RegisterForm,
|
||||||
'forgot-password': ForgotPasswordForm,
|
'send-reset-link': SendResetLinkForm,
|
||||||
'confirm-email': EmailConfirm,
|
'confirm-email': EmailConfirm,
|
||||||
'change-password': ChangePasswordForm,
|
'change-password': ChangePasswordForm,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
export type AuthModalMode = 'login' | 'register' | 'confirm-email' | 'forgot-password' | 'change-password'
|
export type AuthModalMode = 'login' | 'register' | 'confirm-email' | 'send-reset-link' | 'change-password'
|
||||||
export type AuthModalSource =
|
export type AuthModalSource =
|
||||||
| 'discussions'
|
| 'discussions'
|
||||||
| 'vote'
|
| 'vote'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user