add terms page + code refactor
This commit is contained in:
@@ -29,12 +29,8 @@ export const SignupFormSchema = z
|
|||||||
password: z
|
password: z
|
||||||
.string()
|
.string()
|
||||||
.min(8, { error: 'Длина пароля должна быть не менее 8 символов.' })
|
.min(8, { error: 'Длина пароля должна быть не менее 8 символов.' })
|
||||||
.regex(/[a-zA-Z]/, { error: 'Пароль должен содержать как минимум 1 букву.' })
|
.regex(/[a-zA-Zа-яёА-ЯЁ]/, { error: 'Пароль должен содержать как минимум 1 букву.' })
|
||||||
.regex(/[0-9]/, { error: 'Пароль должен содержать как минимум 1 цифру.' })
|
.regex(/[0-9]/, { error: 'Пароль должен содержать как минимум 1 цифру.' })
|
||||||
.refine((value) => !/[а-яёА-ЯЁ]/.test(value),
|
|
||||||
{
|
|
||||||
message: 'Пароль не должен содержать кириллицу.'
|
|
||||||
})
|
|
||||||
.trim(),
|
.trim(),
|
||||||
confirm_password: z
|
confirm_password: z
|
||||||
.string(),
|
.string(),
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import Providers from './providers/providers'
|
import Providers from './providers/getQueryServer'
|
||||||
import type { Metadata } from "next";
|
import type { Metadata } from "next";
|
||||||
import "./styles/globals.css";
|
import "./styles/globals.css";
|
||||||
import "./styles/global-styles.scss"
|
import "./styles/global-styles.scss"
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
export default function Page() {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
terms-and-privacy-policy
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import styles from '@/app/styles/login.module.scss';
|
|||||||
import { useActionState } from 'react';
|
import { useActionState } from 'react';
|
||||||
import { registration } from '@/app/actions/auth';
|
import { registration } from '@/app/actions/auth';
|
||||||
import PhoneInput from '@/app/ui/inputs/phone-input';
|
import PhoneInput from '@/app/ui/inputs/phone-input';
|
||||||
|
import Link from 'next/link';
|
||||||
|
|
||||||
export default function RegisterForm() {
|
export default function RegisterForm() {
|
||||||
const [state, formAction, isPending] = useActionState(
|
const [state, formAction, isPending] = useActionState(
|
||||||
@@ -107,7 +108,14 @@ export default function RegisterForm() {
|
|||||||
name="agree"
|
name="agree"
|
||||||
defaultChecked={state?.previousState?.agree ? true : false}
|
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>
|
</div>
|
||||||
{state?.error?.agree && (
|
{state?.error?.agree && (
|
||||||
<p className="text-sm text-red-500">{state?.error?.agree}</p>
|
<p className="text-sm text-red-500">{state?.error?.agree}</p>
|
||||||
|
|||||||
@@ -11,8 +11,6 @@ export default async function proxy(request: NextRequest) {
|
|||||||
const isPublicRoute = publicRoutes.includes(path);
|
const isPublicRoute = publicRoutes.includes(path);
|
||||||
|
|
||||||
const cookie = (await cookies()).get('session')?.value;
|
const cookie = (await cookies()).get('session')?.value;
|
||||||
console.log("-cookie-");
|
|
||||||
console.log(!!cookie);
|
|
||||||
const session = await decrypt(cookie);
|
const session = await decrypt(cookie);
|
||||||
|
|
||||||
if (isProtectedRoute && !session?.token) {
|
if (isProtectedRoute && !session?.token) {
|
||||||
|
|||||||
Reference in New Issue
Block a user