auth-errors-fix

This commit is contained in:
Untone 2024-05-19 01:04:18 +03:00
parent 135e0d215f
commit 22f0c9052d
3 changed files with 7 additions and 9 deletions

View File

@ -417,6 +417,7 @@
"Username": "Username", "Username": "Username",
"Userpic": "Userpic", "Userpic": "Userpic",
"Users": "Users", "Users": "Users",
"User was not found": "User was not found",
"Video format not supported": "Video format not supported", "Video format not supported": "Video format not supported",
"Video": "Video", "Video": "Video",
"Views": "Views", "Views": "Views",
@ -540,4 +541,4 @@
"Incorrect old password": "Incorrect old password", "Incorrect old password": "Incorrect old password",
"Repeat new password": "Repeat new password", "Repeat new password": "Repeat new password",
"Incorrect new password confirm": "Incorrect new password confirm" "Incorrect new password confirm": "Incorrect new password confirm"
} }

View File

@ -549,6 +549,7 @@
"topicKeywords": "{topic}, Discours.io, статьи, журналистика, исследования", "topicKeywords": "{topic}, Discours.io, статьи, журналистика, исследования",
"topics": "темы", "topics": "темы",
"user already exist": "пользователь уже существует", "user already exist": "пользователь уже существует",
"User was not found": "Пользователь не найден",
"verified": "уже подтверждён", "verified": "уже подтверждён",
"video": "видео", "video": "видео",
"view": "просмотр", "view": "просмотр",
@ -567,4 +568,4 @@
"Incorrect old password": "Старый пароль не верен", "Incorrect old password": "Старый пароль не верен",
"Repeat new password": "Повторите новый пароль", "Repeat new password": "Повторите новый пароль",
"Incorrect new password confirm": "Неверное подтверждение нового пароля" "Incorrect new password confirm": "Неверное подтверждение нового пароля"
} }

View File

@ -96,18 +96,14 @@ export const LoginForm = () => {
try { try {
const { errors } = await signIn({ email: email(), password: password() }) const { errors } = await signIn({ email: email(), password: password() })
if (errors?.length > 0) { if (errors?.length > 0) {
console.debug('[signIn] errors:', errors) console.error('[signIn errors]', errors)
if ( if (errors.some((error) => error.message.includes('user has not signed up email & password'))) {
errors.some(
(error) => error.message.includes('bad user credentials') || error.message.includes('user not'),
)
) {
setValidationErrors((prev) => ({ setValidationErrors((prev) => ({
...prev, ...prev,
password: t('Something went wrong, check email and password'), password: t('Something went wrong, check email and password'),
})) }))
} else if (errors.some((error) => error.message.includes('user not found'))) { } else if (errors.some((error) => error.message.includes('user not found'))) {
setSubmitError('Пользователь не найден') setSubmitError(t('User was not found'))
} else if (errors.some((error) => error.message.includes('email not verified'))) { } else if (errors.some((error) => error.message.includes('email not verified'))) {
setSubmitError( setSubmitError(
<div class={styles.info}> <div class={styles.info}>