From e038cab52058af01bd6a1637358a615fb564a12c Mon Sep 17 00:00:00 2001 From: sdraris Date: Fri, 12 Sep 2025 11:53:59 +0200 Subject: [PATCH] auth service corrected --- src/routes/auth/auth.service.ts | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/routes/auth/auth.service.ts b/src/routes/auth/auth.service.ts index 6f3b9c8..0e514d4 100644 --- a/src/routes/auth/auth.service.ts +++ b/src/routes/auth/auth.service.ts @@ -46,12 +46,12 @@ export class AuthService { const user = await this.usersService.findByEmailOrNull(dto.email); if (!user) { - throw new UnauthorizedException('Identifiants invalides'); + throw new UnauthorizedException('Email invalide'); } - const isMatch = await bcrypt.compare(dto.password, user.password_hash); + const isMatch = await bcrypt.compare(dto.password, user.password); if (!isMatch) { - throw new UnauthorizedException('Identifiants invalides'); + throw new UnauthorizedException('Mot de passe invalide'); } return this.generateTokens(user.id, user.email, user.role); @@ -95,14 +95,14 @@ export class AuthService { registerDto.role = RoleType.PARENT; } - registerDto.status = StatutUtilisateurType.EN_ATTENTE; + registerDto.statut = StatutUtilisateurType.EN_ATTENTE; - if (!registerDto.consent_photo) { - registerDto.consent_photo_at = null; - } else if (registerDto.consent_photo_at) { - const date = new Date(registerDto.consent_photo_at); + if (!registerDto.consentement_photo) { + registerDto.date_consentement_photo = null; + } else if (registerDto.date_consentement_photo) { + const date = new Date(registerDto.date_consentement_photo); if (isNaN(date.getTime())) { - registerDto.consent_photo_at = null; + registerDto.date_consentement_photo = null; } } @@ -116,11 +116,10 @@ export class AuthService { id: user.id, email: user.email, role: user.role, - first_name: user.first_name, - last_name: user.last_name, - status: user.status, + prenom: user.prenom, + nom: user.nom, + statut: user.statut, }, }; } - }