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!

Added validation for registration fields

Yevhenii Kulisidif636599cc0cf
diff --git a/src/auth/dtos/register.dto.ts b/src/auth/dtos/register.dto.ts
index 7bf0d3a22..1bb386c7a 100644
--- a/src/auth/dtos/register.dto.ts
+++ b/src/auth/dtos/register.dto.ts
@@ -1,7 +1,17 @@
+import { IsBoolean, IsEmail, IsNotEmpty, Matches } from 'class-validator'
+
export namespace RegisterDto {
export class Request {
+ @IsEmail()
public readonly email: string
+
+ @Matches(
+ /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*])[a-zA-Z\d!@#$%^&*]{8,72}$/,
+ )
public readonly password: string
+
+ @IsNotEmpty()
+ @IsBoolean()
public readonly checkIfLeaked: boolean
}