add password check
This commit is contained in:
parent
e862fb9b0f
commit
7f75b8f466
|
@ -0,0 +1,9 @@
|
||||||
|
import { IsStrongPasswordOptions } from 'class-validator';
|
||||||
|
|
||||||
|
export const STRONG_PASSWORD_OPTIONS: IsStrongPasswordOptions = {
|
||||||
|
minLength: 8,
|
||||||
|
minLowercase: 1,
|
||||||
|
minNumbers: 1,
|
||||||
|
minSymbols: 1,
|
||||||
|
minUppercase: 1,
|
||||||
|
};
|
|
@ -4,9 +4,11 @@ import {
|
||||||
IsArray,
|
IsArray,
|
||||||
IsNotEmpty,
|
IsNotEmpty,
|
||||||
IsString,
|
IsString,
|
||||||
|
IsStrongPassword,
|
||||||
ValidateNested,
|
ValidateNested,
|
||||||
} from 'class-validator';
|
} from 'class-validator';
|
||||||
import { UsernameDto } from './username.dto';
|
import { UsernameDto } from './username.dto';
|
||||||
|
import { STRONG_PASSWORD_OPTIONS } from '@modules/authentication/authentication.constants';
|
||||||
|
|
||||||
export class CreateAuthenticationRequestDto {
|
export class CreateAuthenticationRequestDto {
|
||||||
@IsString()
|
@IsString()
|
||||||
|
@ -19,7 +21,7 @@ export class CreateAuthenticationRequestDto {
|
||||||
@ValidateNested({ each: true })
|
@ValidateNested({ each: true })
|
||||||
usernames: UsernameDto[];
|
usernames: UsernameDto[];
|
||||||
|
|
||||||
@IsString()
|
@IsStrongPassword(STRONG_PASSWORD_OPTIONS)
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
password: string;
|
password: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
import { IsNotEmpty, IsString } from 'class-validator';
|
import { STRONG_PASSWORD_OPTIONS } from '@modules/authentication/authentication.constants';
|
||||||
|
import { IsNotEmpty, IsString, IsStrongPassword } from 'class-validator';
|
||||||
|
|
||||||
export class UpdatePasswordRequestDto {
|
export class UpdatePasswordRequestDto {
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
userId: string;
|
userId: string;
|
||||||
|
|
||||||
@IsString()
|
@IsStrongPassword(STRONG_PASSWORD_OPTIONS)
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
password: string;
|
password: string;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue