diff --git a/src/modules/auth/auth.controller.ts b/src/modules/auth/auth.controller.ts index 80cbd2be1..692f94382 100644 --- a/src/modules/auth/auth.controller.ts +++ b/src/modules/auth/auth.controller.ts @@ -102,8 +102,12 @@ export class AuthController { } @Post('verify-email') - async verifyEmail(@Body() data: VerifyEmailDto) { - return this.authService.verifyEmail(data.token); + async verifyEmail( + @Ip() ip: string, + @Headers('User-Agent') userAgent: string, + @Body() data: VerifyEmailDto, + ): Promise { + return this.authService.verifyEmail(ip, userAgent, data.token); } @Post('forgot-password') @@ -126,7 +130,7 @@ export class AuthController { @Ip() ip: string, @Headers('User-Agent') userAgent: string, @Body() data: ResetPasswordDto, - ) { + ): Promise { return this.authService.resetPassword( ip, userAgent, diff --git a/src/modules/auth/auth.service.ts b/src/modules/auth/auth.service.ts index d3b4552e5..c1c038855 100644 --- a/src/modules/auth/auth.service.ts +++ b/src/modules/auth/auth.service.ts @@ -388,7 +388,11 @@ export class AuthService { return this.loginResponse(ipAddress, userAgent, user); } - async verifyEmail(token: string): Promise> { + async verifyEmail( + ipAddress: string, + userAgent: string, + token: string, + ): Promise { const { id } = this.tokensService.verify<{ id: number }>( EMAIL_VERIFY_TOKEN, token, @@ -427,7 +431,7 @@ export class AuthService { }, }); } - return this.prisma.expose(result); + return this.loginResponse(ipAddress, userAgent, result.user); } getOneTimePassword(secret: string): string {