forked from Ynov/ptitspas-ynov-back
auth service corrected
This commit is contained in:
parent
a783c1a829
commit
e038cab520
@ -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,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user