Skip to content

Commit

Permalink
test pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanAnquetil committed Sep 3, 2024
1 parent 20cb283 commit 9202997
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 30 deletions.
2 changes: 1 addition & 1 deletion api/src/auth/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class AuthController {
};
if (token) token = token;
return {
message: "L'authentification est validée",
message: "L'authentification est validée !",
data: response,
token: token ?? undefined, // Use undefined if no token is generated because use hasn't a premium subscription.
};
Expand Down
29 changes: 0 additions & 29 deletions api/src/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,35 +51,6 @@ export class AuthService {
return userWithPremium; // Retourne l'objet UserWithPremium
}

// // Validate if user exist and if the login is valid and correspond to the hash stored in database
// async validateUser({ username, password }: AuthPayloadDto) {
// const user: any =
// await this.usersService.findOneByLogin(username);
// //const user: any = await this.usersService.findOneByLogin(username);

// if (user) {
// console.log({ user });
// const hasActivePremiumSubscription: boolean = await this.usersService
// .findOne(user.id)
// .then((user: any) => {
// return user.data.has_active_premium_subscription;
// });
// if (!user)
// throw new HttpException(
// `Utilisateur ou mot de passe inconnu`,
// HttpStatus.UNAUTHORIZED,
// );
// const isValid = loginUser(password, user?.userPass);
// user["is_premium"] = hasActivePremiumSubscription ?? false;
// if (isValid) return user;
// else
// throw new HttpException(
// `Utilisateur ou mot de passe inconnu`,
// HttpStatus.UNAUTHORIZED,
// );
// }
// }
// Generate a token with JwtService
generateToken(user: UserLogin): string {
const payload = { id: user.id, is_premium: user.is_premium };
return this.jwtService.sign(payload);
Expand Down

0 comments on commit 9202997

Please sign in to comment.