Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

Validate twoFactorAuthenticationCode

Blue Mousec364a5787108
diff --git a/backend/apps/cloud/src/twoFactorAuth/dto/2fa-auth.dto.ts b/backend/apps/cloud/src/twoFactorAuth/dto/2fa-auth.dto.ts
index e6ae4013d..7f9cbcb53 100644
--- a/backend/apps/cloud/src/twoFactorAuth/dto/2fa-auth.dto.ts
+++ b/backend/apps/cloud/src/twoFactorAuth/dto/2fa-auth.dto.ts
@@ -1,8 +1,10 @@
import { ApiProperty } from '@nestjs/swagger'
-import { IsNotEmpty } from 'class-validator'
+import { IsNotEmpty, IsString, Matches } from 'class-validator'
export class TwoFactorAuthDTO {
@ApiProperty({ example: '123456', required: true })
@IsNotEmpty()
+ @IsString()
+ @Matches(/^\d{6}$/)
twoFactorAuthenticationCode: string
}
diff --git a/backend/apps/community/src/twoFactorAuth/dto/2fa-auth.dto.ts b/backend/apps/community/src/twoFactorAuth/dto/2fa-auth.dto.ts
index e6ae4013d..7f9cbcb53 100644
--- a/backend/apps/community/src/twoFactorAuth/dto/2fa-auth.dto.ts
+++ b/backend/apps/community/src/twoFactorAuth/dto/2fa-auth.dto.ts
@@ -1,8 +1,10 @@
import { ApiProperty } from '@nestjs/swagger'
-import { IsNotEmpty } from 'class-validator'
+import { IsNotEmpty, IsString, Matches } from 'class-validator'
export class TwoFactorAuthDTO {
@ApiProperty({ example: '123456', required: true })
@IsNotEmpty()
+ @IsString()
+ @Matches(/^\d{6}$/)
twoFactorAuthenticationCode: string
}