📈 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!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
Removed validation of complex passwords for weak passwords
Yevhenii Kulisidi5c1f008bc5be
diff --git a/src/auth/decorators/index.ts b/src/auth/decorators/index.tsindex 5b4cfa3d8..4215329a4 100644--- a/src/auth/decorators/index.ts+++ b/src/auth/decorators/index.ts@@ -1,4 +1,3 @@-export * from './validators'export * from './current-user-id.decorator'export * from './public.decorator'export * from './current-user.decorator'diff --git a/src/auth/decorators/validators/index.ts b/src/auth/decorators/validators/index.tsdeleted file mode 100644index de4a708f5..000000000--- a/src/auth/decorators/validators/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './is-password.validator'diff --git a/src/auth/decorators/validators/is-password.validator.ts b/src/auth/decorators/validators/is-password.validator.tsdeleted file mode 100644index ee4ceb3d1..000000000--- a/src/auth/decorators/validators/is-password.validator.ts+++ /dev/null@@ -1,30 +0,0 @@-import {- registerDecorator,- ValidationOptions,- ValidatorConstraint,- ValidatorConstraintInterface,-} from 'class-validator'--@ValidatorConstraint()-class IsPasswordConstraint implements ValidatorConstraintInterface {- private readonly passwordRegex =- /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*])[a-zA-Z\d!@#$%^&*]{8,72}$/-- public validate(password: string): boolean {- return this.passwordRegex.test(password)- }-}--export function IsPassword(- validationOptions?: ValidationOptions,-): PropertyDecorator {- return function (object: object, propertyName: string) {- registerDecorator({- propertyName,- target: object.constructor,- validator: IsPasswordConstraint,- constraints: [],- options: validationOptions,- })- }-}diff --git a/src/auth/dtos/change-password.dto.ts b/src/auth/dtos/change-password.dto.tsindex a9aace2e9..2f8e41311 100644--- a/src/auth/dtos/change-password.dto.ts+++ b/src/auth/dtos/change-password.dto.ts@@ -1,5 +1,5 @@import { ApiProperty } from '@nestjs/swagger'-import { IsPassword } from '../decorators'+import { MaxLength, MinLength } from 'class-validator'export class ChangePasswordDto {@ApiProperty({@@ -8,7 +8,8 @@ export class ChangePasswordDto {maxLength: 72,minLength: 8,})- @IsPassword({ message: 'Please enter the valid password.' })+ @MaxLength(50, { message: 'Max length is $constraint1 characters' })+ @MinLength(8, { message: 'Min length is $constraint1 characters' })public readonly oldPassword: string@ApiProperty({@@ -17,6 +18,7 @@ export class ChangePasswordDto {maxLength: 72,minLength: 8,})- @IsPassword({ message: 'Please enter the valid password.' })+ @MaxLength(50, { message: 'Max length is $constraint1 characters' })+ @MinLength(8, { message: 'Min length is $constraint1 characters' })public readonly newPassword: string}diff --git a/src/auth/dtos/register.dto.ts b/src/auth/dtos/register.dto.tsindex 93f0da119..c1669d49a 100644--- a/src/auth/dtos/register.dto.ts+++ b/src/auth/dtos/register.dto.ts@@ -1,6 +1,11 @@import { ApiProperty } from '@nestjs/swagger'-import { IsEmail, IsNotEmpty, IsBoolean } from 'class-validator'-import { IsPassword } from '../decorators'+import {+ IsEmail,+ IsNotEmpty,+ IsBoolean,+ MaxLength,+ MinLength,+} from 'class-validator'export class RegisterRequestDto {@ApiProperty({@@ -18,7 +23,8 @@ export class RegisterRequestDto {maxLength: 72,minLength: 8,})- @IsPassword({ message: 'Please enter the valid password.' })+ @MaxLength(50, { message: 'Max length is $constraint1 characters' })+ @MinLength(8, { message: 'Min length is $constraint1 characters' })public readonly password: string@ApiProperty({diff --git a/src/auth/dtos/request-change-email.dto.ts b/src/auth/dtos/request-change-email.dto.tsindex c4e0d33ee..6c1bde5db 100644--- a/src/auth/dtos/request-change-email.dto.ts+++ b/src/auth/dtos/request-change-email.dto.ts@@ -1,6 +1,5 @@import { ApiProperty } from '@nestjs/swagger'-import { IsEmail } from 'class-validator'-import { IsPassword } from '../decorators'+import { IsEmail, MaxLength, MinLength } from 'class-validator'export class RequestChangeEmailDto {@ApiProperty({@@ -18,6 +17,7 @@ export class RequestChangeEmailDto {maxLength: 72,minLength: 8,})- @IsPassword({ message: 'Please enter the valid password.' })+ @MaxLength(50, { message: 'Max length is $constraint1 characters' })+ @MinLength(8, { message: 'Min length is $constraint1 characters' })public readonly password: string}diff --git a/src/auth/dtos/reset-password.dto.ts b/src/auth/dtos/reset-password.dto.tsindex d6cc41a23..14df63e68 100644--- a/src/auth/dtos/reset-password.dto.ts+++ b/src/auth/dtos/reset-password.dto.ts@@ -1,5 +1,5 @@import { ApiProperty } from '@nestjs/swagger'-import { IsPassword } from '../decorators'+import { MaxLength, MinLength } from 'class-validator'export class ResetPasswordDto {@ApiProperty({@@ -8,6 +8,7 @@ export class ResetPasswordDto {maxLength: 72,minLength: 8,})- @IsPassword({ message: 'Please enter the valid password.' })+ @MaxLength(50, { message: 'Max length is $constraint1 characters' })+ @MinLength(8, { message: 'Min length is $constraint1 characters' })public readonly newPassword: string}