environment

This commit is contained in:
Bastian Wagner
2024-09-13 21:42:05 +02:00
parent d552bd0c09
commit 00d5498e00
11 changed files with 43 additions and 70 deletions

View File

@@ -22,6 +22,7 @@ export class AuthController {
@Body() authDto: AuthCodeDto,
): Promise<User> {
const user = await this.authService.registerOrLoginWithAuthCode(authDto);
console.log(user)
if (user == null) {
throw new HttpException('forbidden', HttpStatus.FORBIDDEN);
}

View File

@@ -27,6 +27,9 @@ export class AuthService {
this.http.post(url, body).subscribe({
next: async (response) => {
const user = await this.saveExternalTokens(response.data as any);
if (!user) {
return resolve(null);
}
this.generateTokens(user);
resolve(user);
},
@@ -55,7 +58,7 @@ export class AuthService {
});
}
if (!user.isActive) {
throw new HttpException('not active', HttpStatus.FORBIDDEN);
return resolve(null);
}
user.firstName = payload.firstName;