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:
Jose Selesan
2026-06-01 16:43:52 -03:00
parent 4d3867614d
commit 2aaa91444d
14 changed files with 352 additions and 9 deletions

View File

@@ -2,6 +2,7 @@ import { dash } from '@better-auth/infra';
import { betterAuth } from 'better-auth';
import { prismaAdapter } from 'better-auth/adapters/prisma';
import { openAPI } from 'better-auth/plugins';
import { sendMail } from './mailer';
import { db } from './prisma';
export const auth = betterAuth({
@@ -18,6 +19,26 @@ export const auth = betterAuth({
emailAndPassword: {
enabled: true,
},
user: {
additionalFields: {
phone: {
type: 'string',
required: false,
},
},
},
emailVerification: {
sendOnSignUp: true,
autoSignInAfterVerification: true,
sendVerificationEmail: async ({ user, url }) => {
await sendMail({
to: user.email,
subject: 'Verificá tu email en Playzer',
html: `Hacé click para verificar tu email: <a href="${url}">${url}</a>`,
text: `Hacé click para verificar tu email: ${url}`,
});
},
},
socialProviders: {
google: {
clientId: process.env.GOOGLE_CLIENT_ID!,