take user agent and user ip for NCFRONT-166

This commit is contained in:
smanylov
2026-03-23 12:45:05 +07:00
parent 3a3a514825
commit b7865acbe3
2 changed files with 9 additions and 1 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "no-copy-frontend",
"version": "0.67.0",
"version": "0.68.0",
"private": true,
"scripts": {
"dev": "next dev -p 2999",
+8
View File
@@ -4,6 +4,7 @@ import { loginFormSchema, API_BASE_URL, getSignupFormSchema } from '@/app/action
import { createSession, deleteSession, getSessionData, updateSession } from '@/app/actions/session';
import { redirect } from 'next/navigation';
import { fetchINN } from '@/app/actions/action';
import { headers } from 'next/headers';
export async function logout() {
const token = await getSessionData('token');
@@ -150,6 +151,7 @@ export async function registration(
state: FormState | undefined,
formData: FormData,
): Promise<FormState> {
const headersList = await headers();
const accountType = formData.get('accountType') as 'b2b' | 'b2c';
/* вернуть в true когда проект выйдет из дева */
@@ -164,6 +166,12 @@ export async function registration(
const referralCode = formData.get('referralCode') as string || '';
const inn = formData.get('inn') as string || '';
const forwardedFor = headersList.get('x-forwarded-for');
const realIp = headersList.get('x-real-ip');
const ip = forwardedFor?.split(',')[0] || realIp || 'unknown';
const userAgent = headersList.get('user-agent') || 'unknown';
const SignupFormSchema = await getSignupFormSchema(accountType);
const dataToValidate = {