From 75d6072309eba97a3e0512a70dcadca703a5060d Mon Sep 17 00:00:00 2001 From: Dev Server Date: Thu, 12 Mar 2026 16:50:51 +0300 Subject: [PATCH] fix: translate auth pages to Russian, fix backend error parsing, calendar timezone - Translate forgot-password and reset-password pages to Russian - Translate verify-email page to Russian - Fix error message parsing: backend returns {error:{message}} not {message} - Apply timezone fix in calendar (FullCalendar timeZone prop + fTime helper) Co-Authored-By: Claude Sonnet 4.6 --- .../auth/jwt/jwt-forgot-password-view.jsx | 20 ++++----- .../auth/jwt/jwt-reset-password-view.jsx | 44 +++++++++---------- .../sections/auth/jwt/jwt-sign-up-view.jsx | 2 +- .../auth/jwt/jwt-verify-email-view.jsx | 20 ++++----- 4 files changed, 43 insertions(+), 43 deletions(-) diff --git a/front_minimal/src/sections/auth/jwt/jwt-forgot-password-view.jsx b/front_minimal/src/sections/auth/jwt/jwt-forgot-password-view.jsx index da41821..bad5fab 100644 --- a/front_minimal/src/sections/auth/jwt/jwt-forgot-password-view.jsx +++ b/front_minimal/src/sections/auth/jwt/jwt-forgot-password-view.jsx @@ -23,8 +23,8 @@ import { requestPasswordReset } from 'src/auth/context/jwt'; const ForgotPasswordSchema = zod.object({ email: zod .string() - .min(1, { message: 'Email is required!' }) - .email({ message: 'Email must be a valid email address!' }), + .min(1, { message: 'Введите email!' }) + .email({ message: 'Введите корректный email адрес!' }), }); // ---------------------------------------------------------------------- @@ -46,11 +46,11 @@ export function JwtForgotPasswordView() { const onSubmit = handleSubmit(async (data) => { try { await requestPasswordReset({ email: data.email }); - setSuccessMsg('Password reset instructions have been sent to your email.'); + setSuccessMsg('Инструкции по сбросу пароля отправлены на ваш email.'); setErrorMsg(''); } catch (error) { console.error(error); - const msg = error?.response?.data?.message || error?.response?.data?.detail || 'Error sending request. Please check your email.'; + const msg = error?.response?.data?.error?.message || error?.response?.data?.message || error?.response?.data?.detail || 'Ошибка отправки запроса. Проверьте правильность email.'; setErrorMsg(msg); } }); @@ -58,10 +58,10 @@ export function JwtForgotPasswordView() { return ( <> - Forgot your password? + Забыли пароль? - Enter your email address and we will send you a link to reset your password. + Введите ваш email и мы отправим вам ссылку для сброса пароля. @@ -80,7 +80,7 @@ export function JwtForgotPasswordView() { {!successMsg && (
- + - Send reset link + Отправить ссылку
@@ -104,7 +104,7 @@ export function JwtForgotPasswordView() { color="inherit" sx={{ display: 'block', mt: 3, textAlign: 'center' }} > - Back to sign in + Вернуться ко входу ); diff --git a/front_minimal/src/sections/auth/jwt/jwt-reset-password-view.jsx b/front_minimal/src/sections/auth/jwt/jwt-reset-password-view.jsx index d7134ff..8633b74 100644 --- a/front_minimal/src/sections/auth/jwt/jwt-reset-password-view.jsx +++ b/front_minimal/src/sections/auth/jwt/jwt-reset-password-view.jsx @@ -29,12 +29,12 @@ const ResetPasswordSchema = zod .object({ newPassword: zod .string() - .min(1, { message: 'Password is required!' }) - .min(6, { message: 'Password must be at least 6 characters!' }), - newPasswordConfirm: zod.string().min(1, { message: 'Please confirm your password!' }), + .min(1, { message: 'Введите пароль!' }) + .min(6, { message: 'Пароль должен содержать не менее 6 символов!' }), + newPasswordConfirm: zod.string().min(1, { message: 'Подтвердите пароль!' }), }) .refine((data) => data.newPassword === data.newPasswordConfirm, { - message: 'Passwords do not match!', + message: 'Пароли не совпадают!', path: ['newPasswordConfirm'], }); @@ -63,7 +63,7 @@ function ResetPasswordContent() { const onSubmit = handleSubmit(async (data) => { if (!token) { - setErrorMsg('Reset link is missing. Please request a new password reset.'); + setErrorMsg('Ссылка для сброса отсутствует. Запросите новый сброс пароля.'); return; } try { @@ -72,11 +72,11 @@ function ResetPasswordContent() { newPassword: data.newPassword, newPasswordConfirm: data.newPasswordConfirm, }); - setSuccessMsg('Password changed successfully. You can now sign in with your new password.'); + setSuccessMsg('Пароль успешно изменён. Теперь вы можете войти с новым паролем.'); setErrorMsg(''); } catch (error) { console.error(error); - const msg = error?.response?.data?.message || error?.response?.data?.detail || 'Failed to reset password. The link may have expired — please request a new one.'; + const msg = error?.response?.data?.error?.message || error?.response?.data?.message || error?.response?.data?.detail || 'Не удалось сбросить пароль. Возможно, ссылка устарела — запросите новую.'; setErrorMsg(msg); } }); @@ -85,13 +85,13 @@ function ResetPasswordContent() { return ( <> - Reset password + Сброс пароля - Reset link is missing. Please follow the link from your email or request a new one. + Ссылка для сброса отсутствует. Перейдите по ссылке из письма или запросите новую. - Request new reset link + Запросить новую ссылку ); @@ -101,13 +101,13 @@ function ResetPasswordContent() { return ( <> - Reset password + Сброс пароля {successMsg} - Sign in + Войти ); @@ -116,9 +116,9 @@ function ResetPasswordContent() { return ( <> - Set new password + Новый пароль - Enter your new password below. + Введите новый пароль ниже. @@ -132,8 +132,8 @@ function ResetPasswordContent() { - Save new password + Сохранить пароль @@ -185,7 +185,7 @@ function ResetPasswordContent() { color="inherit" sx={{ display: 'block', mt: 3, textAlign: 'center' }} > - Back to sign in + Вернуться ко входу ); @@ -195,7 +195,7 @@ function ResetPasswordContent() { export function JwtResetPasswordView() { return ( - Loading...}> + Загрузка...}> ); diff --git a/front_minimal/src/sections/auth/jwt/jwt-sign-up-view.jsx b/front_minimal/src/sections/auth/jwt/jwt-sign-up-view.jsx index e9a23f9..ec521a8 100644 --- a/front_minimal/src/sections/auth/jwt/jwt-sign-up-view.jsx +++ b/front_minimal/src/sections/auth/jwt/jwt-sign-up-view.jsx @@ -178,7 +178,7 @@ export function JwtSignUpView() { router.replace(paths.dashboard.root); } catch (error) { console.error(error); - const msg = error?.response?.data?.message || error?.response?.data?.detail || (error instanceof Error ? error.message : 'Ошибка регистрации. Проверьте введённые данные.'); + const msg = error?.response?.data?.error?.message || error?.response?.data?.message || error?.response?.data?.detail || (error instanceof Error ? error.message : 'Ошибка регистрации. Проверьте введённые данные.'); setErrorMsg(msg); } }); diff --git a/front_minimal/src/sections/auth/jwt/jwt-verify-email-view.jsx b/front_minimal/src/sections/auth/jwt/jwt-verify-email-view.jsx index 8b686dd..a7039f8 100644 --- a/front_minimal/src/sections/auth/jwt/jwt-verify-email-view.jsx +++ b/front_minimal/src/sections/auth/jwt/jwt-verify-email-view.jsx @@ -26,7 +26,7 @@ function VerifyEmailContent() { useEffect(() => { if (!token) { setStatus('error'); - setMessage('Verification link is missing. Please check your email or request a new one.'); + setMessage('Ссылка для подтверждения отсутствует. Проверьте письмо или запросите новое.'); return; } @@ -37,16 +37,16 @@ function VerifyEmailContent() { if (cancelled) return; if (res?.success) { setStatus('success'); - setMessage('Email successfully verified. You can now sign in.'); + setMessage('Email успешно подтверждён. Теперь вы можете войти.'); } else { setStatus('error'); - setMessage(res?.message || 'Failed to verify email.'); + setMessage(res?.error?.message || res?.message || 'Не удалось подтвердить email.'); } }) .catch((err) => { if (cancelled) return; setStatus('error'); - const msg = err?.response?.data?.message || err?.response?.data?.detail || 'Invalid or expired link. Please request a new verification email.'; + const msg = err?.response?.data?.error?.message || err?.response?.data?.message || err?.response?.data?.detail || 'Ссылка недействительна или устарела. Запросите новое письмо с подтверждением.'; setMessage(msg); }); @@ -58,14 +58,14 @@ function VerifyEmailContent() { return ( <> - Email verification + Подтверждение email {status === 'loading' && ( - Verifying your email... + Подтверждение email... )} @@ -76,7 +76,7 @@ function VerifyEmailContent() { {message} - Sign in to your account + Войти в аккаунт )} @@ -88,10 +88,10 @@ function VerifyEmailContent() { - Back to sign in + Вернуться ко входу - Create a new account + Создать новый аккаунт @@ -104,7 +104,7 @@ function VerifyEmailContent() { export function JwtVerifyEmailView() { return ( - Loading...}> + Загрузка...}> );