feat: add phone field to User model and update authentication flow
- Added phone field to User model in Prisma schema and generated types. - Updated backend authentication to include phone as an additional field. - Implemented phone input in the signup form with validation. - Created a new SignupPage component for user registration. - Updated routing to include signup path and redirect authenticated users. - Modified login page to reference Playzer and added link to signup.
This commit is contained in:
@@ -1,10 +1,21 @@
|
||||
import { sentinelClient } from '@better-auth/infra/client';
|
||||
import { inferAdditionalFields } from 'better-auth/client/plugins';
|
||||
import { createAuthClient } from 'better-auth/react';
|
||||
import * as api from './api';
|
||||
|
||||
const apiBaseUrl = api.apiBaseUrl;
|
||||
|
||||
const plugins = [sentinelClient()];
|
||||
const plugins = [
|
||||
sentinelClient(),
|
||||
inferAdditionalFields({
|
||||
user: {
|
||||
phone: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
},
|
||||
},
|
||||
}),
|
||||
];
|
||||
|
||||
export const authClient = createAuthClient({
|
||||
baseURL: apiBaseUrl,
|
||||
|
||||
@@ -13,6 +13,7 @@ type SignUpParams = {
|
||||
email: string;
|
||||
password: string;
|
||||
fullName: string;
|
||||
phone?: string;
|
||||
};
|
||||
|
||||
type UpdateProfileParams = {
|
||||
@@ -162,11 +163,12 @@ export function AuthProvider({ children }: PropsWithChildren) {
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
signUp: async ({ email, password, fullName }) => {
|
||||
signUp: async ({ email, password, fullName, phone }) => {
|
||||
const { data: signUpData, error } = await authClient.signUp.email({
|
||||
email,
|
||||
password,
|
||||
name: fullName,
|
||||
phone,
|
||||
});
|
||||
|
||||
if (error) {
|
||||
|
||||
Reference in New Issue
Block a user