fix company user registration
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
import { API_BASE_URL, getSignupFormSchema } from '@/app/actions/definitions';
|
||||
import { getSessionData } from '@/app/actions/session';
|
||||
import { headers } from 'next/headers';
|
||||
|
||||
export type CompanyUserRegistrationFormState = {
|
||||
previousState: {
|
||||
@@ -24,6 +25,8 @@ export async function companyUserRegistration(
|
||||
return;
|
||||
}
|
||||
|
||||
const headersList = await headers();
|
||||
|
||||
const fullName = formData.get('fullName') as string || '';
|
||||
const email = formData.get('email') as string || '';
|
||||
const password = formData.get('password') as string || '';
|
||||
@@ -32,6 +35,11 @@ export async function companyUserRegistration(
|
||||
|
||||
const SignupFormSchema = await getSignupFormSchema('b2c');
|
||||
|
||||
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 dataToValidate = {
|
||||
fullName,
|
||||
email,
|
||||
@@ -88,7 +96,9 @@ export async function companyUserRegistration(
|
||||
password,
|
||||
accountType: 'b2b',
|
||||
authToken: token,
|
||||
mail_verified: false
|
||||
mail_verified: false,
|
||||
ip: ip,
|
||||
user_agent: userAgent,
|
||||
}
|
||||
}),
|
||||
headers: {
|
||||
@@ -118,7 +128,9 @@ export async function companyUserRegistration(
|
||||
fullName: fullName,
|
||||
email,
|
||||
phone: phone,
|
||||
password
|
||||
password,
|
||||
ip: ip,
|
||||
user_agent: userAgent,
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user