feat: add logs for successful registration, successful login and failed login

This commit is contained in:
Elias Schneider
2024-07-10 18:39:47 +02:00
parent 9d9cc7b4ab
commit d2bfb9a55f
4 changed files with 30 additions and 15 deletions

View File

@@ -45,12 +45,13 @@ export class AuthController {
})
async signUp(
@Body() dto: AuthRegisterDTO,
@Req() { ip }: Request,
@Res({ passthrough: true }) response: Response,
) {
if (!this.config.get("share.allowRegistration"))
throw new ForbiddenException("Registration is not allowed");
const result = await this.authService.signUp(dto);
const result = await this.authService.signUp(dto, ip);
this.authService.addTokensToResponse(
response,
@@ -71,9 +72,10 @@ export class AuthController {
@HttpCode(200)
async signIn(
@Body() dto: AuthSignInDTO,
@Req() { ip }: Request,
@Res({ passthrough: true }) response: Response,
) {
const result = await this.authService.signIn(dto);
const result = await this.authService.signIn(dto, ip);
if (result.accessToken && result.refreshToken) {
this.authService.addTokensToResponse(