feat: add verify otp endpoint
This commit is contained in:
@@ -23,7 +23,6 @@ export class OTP {
|
||||
|
||||
@Column({
|
||||
type: 'varchar',
|
||||
length: 5,
|
||||
nullable: false,
|
||||
})
|
||||
code: string;
|
||||
|
||||
@@ -84,8 +84,9 @@ export class OtpService {
|
||||
throw new UnauthorizedException('OTP expired');
|
||||
}
|
||||
|
||||
// TODO: Compared hashed otp
|
||||
if (otp.code !== code) {
|
||||
const isOTPCorrect = await this.hashingProvider.compare(code, otp.code);
|
||||
|
||||
if (!isOTPCorrect) {
|
||||
throw new UnauthorizedException('Invalid OTP');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user