mirror of
https://gitlab.com/mobicoop/v3/service/auth.git
synced 2026-01-08 01:12:40 +00:00
Merge branch 'passwordOptions' into 'main'
add password check See merge request v3/service/auth!50
This commit is contained in:
9
src/modules/authentication/authentication.constants.ts
Normal file
9
src/modules/authentication/authentication.constants.ts
Normal file
@@ -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,
|
||||
IsNotEmpty,
|
||||
IsString,
|
||||
IsStrongPassword,
|
||||
ValidateNested,
|
||||
} from 'class-validator';
|
||||
import { UsernameDto } from './username.dto';
|
||||
import { STRONG_PASSWORD_OPTIONS } from '@modules/authentication/authentication.constants';
|
||||
|
||||
export class CreateAuthenticationRequestDto {
|
||||
@IsString()
|
||||
@@ -19,7 +21,7 @@ export class CreateAuthenticationRequestDto {
|
||||
@ValidateNested({ each: true })
|
||||
usernames: UsernameDto[];
|
||||
|
||||
@IsString()
|
||||
@IsStrongPassword(STRONG_PASSWORD_OPTIONS)
|
||||
@IsNotEmpty()
|
||||
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 {
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
userId: string;
|
||||
|
||||
@IsString()
|
||||
@IsStrongPassword(STRONG_PASSWORD_OPTIONS)
|
||||
@IsNotEmpty()
|
||||
password: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user