Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ STACK_NAME=full-stack-fastapi-project

# Backend
BACKEND_CORS_ORIGINS="http://localhost,http://localhost:5173,https://localhost,https://localhost:5173,http://localhost.tiangolo.com"
SECRET_KEY=changethis
SECRET_KEY=123
[email protected]
FIRST_SUPERUSER_PASSWORD=changethis
FIRST_SUPERUSER_PASSWORD=123

# Emails
SMTP_HOST=
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/routes/_layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ function Dashboard() {
<Container maxW="full">
<Box pt={12} m={4}>
<Text fontSize="2xl">
Hi, {currentUser?.full_name || currentUser?.email} 👋🏼
Привет, {currentUser?.full_name || currentUser?.email} 👋🏼
</Text>
<Text>Welcome back, nice to see you again!</Text>
<Text>Добро пожаловать обратно, приятно видеть вас снова!</Text>
</Box>
</Container>
</>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/routes/signup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,12 @@ function SignUp() {
)}
</FormControl>
<Button variant="primary" type="submit" isLoading={isSubmitting}>
Sign Up
Выйти
</Button>
<Text>
Already have an account?{" "}
<Link as={RouterLink} to="/login" color="blue.500">
Log In
Вход
</Link>
</Text>
</Container>
Expand Down
16 changes: 8 additions & 8 deletions frontend/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ import type { ApiError } from "./client"

export const emailPattern = {
value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,
message: "Invalid email address",
message: "Неверный email address",
}

export const namePattern = {
value: /^[A-Za-z\s\u00C0-\u017F]{1,30}$/,
message: "Invalid name",
message: "Неверное имя",
}

export const passwordRules = (isRequired = true) => {
const rules: any = {
minLength: {
value: 8,
message: "Password must be at least 8 characters",
message: "Пароль должен содердать 8 символов",
},
}

if (isRequired) {
rules.required = "Password is required"
rules.required = "Требуется ввести пароль"
}

return rules
Expand All @@ -32,22 +32,22 @@ export const confirmPasswordRules = (
const rules: any = {
validate: (value: string) => {
const password = getValues().password || getValues().new_password
return value === password ? true : "The passwords do not match"
return value === password ? true : "Пароли не совпадают"
},
}

if (isRequired) {
rules.required = "Password confirmation is required"
rules.required = "Требуется подтверждение пароля"
}

return rules
}

export const handleError = (err: ApiError, showToast: any) => {
const errDetail = (err.body as any)?.detail
let errorMessage = errDetail || "Something went wrong."
let errorMessage = errDetail || "Что-то пошло не так."
if (Array.isArray(errDetail) && errDetail.length > 0) {
errorMessage = errDetail[0].msg
}
showToast("Error", errorMessage, "error")
showToast("Error", errorMessage, "ошибка")
}
Loading