fix issues suggested by coderabbit

This commit is contained in:
Amruth Pillai
2025-01-13 16:22:29 +01:00
parent 33cb3dbd6a
commit 227870ac78
4 changed files with 14 additions and 10 deletions
@@ -33,11 +33,11 @@ export class GitHubStrategy extends PassportStrategy(Strategy, "github") {
if (!email) throw new BadRequestException(ErrorMessage.InvalidCredentials);
try {
const user =
user =
(await this.userService.findOneByIdentifier(email)) ??
(username && (await this.userService.findOneByIdentifier(username)));
(username ? await this.userService.findOneByIdentifier(username) : null);
if (!user) throw new Error(ErrorMessage.InvalidCredentials);
if (!user) throw new BadRequestException(ErrorMessage.InvalidCredentials);
done(null, user);
} catch {