diff --git a/src/users/users.controller.ts b/src/users/users.controller.ts index 43fb564f56211d4f7fd7b0952d9237f8308d3bb4..a3d450e51a4c4fdc4bbb6bce6e46234165bf65a8 100644 --- a/src/users/users.controller.ts +++ b/src/users/users.controller.ts @@ -86,4 +86,9 @@ export class UsersController { public async resetPasswordApply(@Body() passwordResetApplyDto: PasswordResetApplyDto) { return this.usersService.validatePasswordResetToken(passwordResetApplyDto.password, passwordResetApplyDto.token); } + + @Post('verify-exist-user') + public async verifyUserExist(@Request() req, @Body() email: { newMail: string }) { + return this.usersService.verifyUserExist(email.newMail); + } } diff --git a/src/users/users.service.ts b/src/users/users.service.ts index f683ebdca2a3a881a199c5b85964daf50557db6f..0feba3e6bfb17f28c53448c7c1cd12ecab5ae195 100644 --- a/src/users/users.service.ts +++ b/src/users/users.service.ts @@ -407,4 +407,9 @@ export class UsersService { user.save(); }); } + + public async verifyUserExist(email: string): Promise<Boolean> { + const user = await this.findOne(email); + return user ? true : false; + } }