feat: Implement OTP-based authentication with Redis, SMS, and email services, including new controllers and providers.

This commit is contained in:
2026-02-09 16:59:07 +03:00
parent 817be5e8c9
commit e87a5b507e
9 changed files with 176 additions and 3 deletions
+25
View File
@@ -0,0 +1,25 @@
// mail.service.ts
import { Injectable } from '@nestjs/common';
import * as nodemailer from 'nodemailer';
@Injectable()
export class MailService {
private transporter = nodemailer.createTransport({
host: process.env.SMTP_HOST,
port: Number(process.env.SMTP_PORT),
secure: true,
auth: {
user: process.env.SMTP_USER,
pass: process.env.SMTP_PASS
}
});
async sendOtp(email: string, otp: string) {
await this.transporter.sendMail({
from: '"Your App" <[email protected]>',
to: email,
subject: 'Your OTP Code',
text: `Your verification code is ${otp}. It expires in 5 minutes.`
});
}
}