add terms page + code refactor

This commit is contained in:
smanylov
2025-12-10 11:42:52 +07:00
parent 2ff5b636c0
commit d9c26b079d
6 changed files with 18 additions and 9 deletions
+1 -5
View File
@@ -29,12 +29,8 @@ export const SignupFormSchema = z
password: z
.string()
.min(8, { error: 'Длина пароля должна быть не менее 8 символов.' })
.regex(/[a-zA-Z]/, { error: 'Пароль должен содержать как минимум 1 букву.' })
.regex(/[a-zA-Zа-яёА-ЯЁ]/, { error: 'Пароль должен содержать как минимум 1 букву.' })
.regex(/[0-9]/, { error: 'Пароль должен содержать как минимум 1 цифру.' })
.refine((value) => !/[а-яёА-ЯЁ]/.test(value),
{
message: 'Пароль не должен содержать кириллицу.'
})
.trim(),
confirm_password: z
.string(),
+1 -1
View File
@@ -1,4 +1,4 @@
import Providers from './providers/providers'
import Providers from './providers/getQueryServer'
import type { Metadata } from "next";
import "./styles/globals.css";
import "./styles/global-styles.scss"
@@ -0,0 +1,7 @@
export default function Page() {
return (
<div>
terms-and-privacy-policy
</div>
)
}
+9 -1
View File
@@ -4,6 +4,7 @@ import styles from '@/app/styles/login.module.scss';
import { useActionState } from 'react';
import { registration } from '@/app/actions/auth';
import PhoneInput from '@/app/ui/inputs/phone-input';
import Link from 'next/link';
export default function RegisterForm() {
const [state, formAction, isPending] = useActionState(
@@ -107,7 +108,14 @@ export default function RegisterForm() {
name="agree"
defaultChecked={state?.previousState?.agree ? true : false}
/>
<label htmlFor="agree">Я соглашаюсь с <a href="/" >условиями использования и политикой конфиденциальности</a></label>
<label htmlFor="agree">Я соглашаюсь с
<Link
href="/terms-and-privacy-policy"
target="_blank"
>
условиями использования и политикой конфиденциальности
</Link>
</label>
</div>
{state?.error?.agree && (
<p className="text-sm text-red-500">{state?.error?.agree}</p>
-2
View File
@@ -11,8 +11,6 @@ export default async function proxy(request: NextRequest) {
const isPublicRoute = publicRoutes.includes(path);
const cookie = (await cookies()).get('session')?.value;
console.log("-cookie-");
console.log(!!cookie);
const session = await decrypt(cookie);
if (isProtectedRoute && !session?.token) {