feat: Implement email service with welcome, password reset, and verification templates, and add application logo.
This commit is contained in:
@@ -25,6 +25,7 @@ import {
|
||||
ForgotPasswordDto,
|
||||
ResetPasswordDto,
|
||||
RefreshTokenDto,
|
||||
VerifyEmailDto,
|
||||
} from './dto';
|
||||
import { JwtAuthGuard } from './guards';
|
||||
import { Public, CurrentUser } from './decorators';
|
||||
@@ -189,6 +190,56 @@ export class AuthController {
|
||||
return this.authService.resetPassword(dto);
|
||||
}
|
||||
|
||||
// ==========================================
|
||||
// VERIFY EMAIL
|
||||
// ==========================================
|
||||
@Public()
|
||||
@Post('verify-email')
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@ApiOperation({ summary: 'Verify email with token' })
|
||||
@ApiBody({ type: VerifyEmailDto })
|
||||
@ApiResponse({
|
||||
status: 200,
|
||||
description: 'Email verified successfully',
|
||||
schema: {
|
||||
example: {
|
||||
success: true,
|
||||
data: {
|
||||
message: 'Email verified successfully',
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
@ApiResponse({ status: 400, description: 'Invalid or expired token' })
|
||||
async verifyEmail(@Body() dto: VerifyEmailDto) {
|
||||
return this.authService.verifyEmail(dto);
|
||||
}
|
||||
|
||||
// ==========================================
|
||||
// RESEND VERIFICATION EMAIL
|
||||
// ==========================================
|
||||
@Post('resend-verification')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@ApiBearerAuth('JWT-auth')
|
||||
@ApiOperation({ summary: 'Resend email verification' })
|
||||
@ApiResponse({
|
||||
status: 200,
|
||||
description: 'Verification email sent',
|
||||
schema: {
|
||||
example: {
|
||||
success: true,
|
||||
data: {
|
||||
message: 'Verification email sent',
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
@ApiResponse({ status: 401, description: 'Unauthorized' })
|
||||
async resendVerification(@CurrentUser('id') userId: string) {
|
||||
return this.authService.resendVerificationEmail(userId);
|
||||
}
|
||||
|
||||
// ==========================================
|
||||
// REFRESH TOKEN
|
||||
// ==========================================
|
||||
|
||||
Reference in New Issue
Block a user