fix: fix otp security issue and race condition
This commit is contained in:
@@ -38,6 +38,9 @@ export class OTP extends BaseEntity {
|
||||
@Column({ type: 'boolean', default: false })
|
||||
used!: boolean;
|
||||
|
||||
@Column({ type: 'integer', default: 0 })
|
||||
failedAttempts!: number;
|
||||
|
||||
@BeforeInsert()
|
||||
setExpiry() {
|
||||
this.expiresAt = new Date(Date.now() + 2 * 60 * 1000);
|
||||
|
||||
Reference in New Issue
Block a user