File

apps/recallassess/recallassess-api/src/api/client/auth/dto/password-setup.dto.ts

Index

Properties

Properties

message
Type : string
Decorators :
@Expose()
success
Type : boolean
Decorators :
@Expose()
import { IsNotEmpty, IsString, Matches, MinLength } from "class-validator";
import { PASSWORD_REQUIREMENTS } from "../../../../config/password.config";
import { Exclude, Expose } from "class-transformer";

@Exclude()
export class SetupPasswordDto {
  @Expose()
  @IsNotEmpty()
  @IsString()
  token!: string;

  @Expose()
  @IsNotEmpty()
  @IsString()
  @MinLength(PASSWORD_REQUIREMENTS.minLength, {
    message: "Password must be at least 8 characters long",
  })
  @Matches(PASSWORD_REQUIREMENTS.uppercase, {
    message: "Password must contain at least one uppercase letter",
  })
  @Matches(PASSWORD_REQUIREMENTS.number, {
    message: "Password must contain at least one number",
  })
  @Matches(PASSWORD_REQUIREMENTS.special, {
    message: "Password must contain at least one symbol (e.g. !@#$%^&*)",
  })
  password!: string;
}

/** DTO for set-password: initial password only when participant has no password_hash yet */
@Exclude()
export class SetPasswordDto {
  @Expose()
  @IsNotEmpty()
  @IsString()
  @MinLength(PASSWORD_REQUIREMENTS.minLength, {
    message: "Password must be at least 8 characters long",
  })
  @Matches(PASSWORD_REQUIREMENTS.uppercase, {
    message: "Password must contain at least one uppercase letter",
  })
  @Matches(PASSWORD_REQUIREMENTS.number, {
    message: "Password must contain at least one number",
  })
  @Matches(PASSWORD_REQUIREMENTS.special, {
    message: "Password must contain at least one symbol (e.g. !@#$%^&*)",
  })
  password!: string;
}

@Exclude()
export class SetupPasswordResponseDto {
  @Expose()
  success!: boolean;
  @Expose()
  message!: string;
}

results matching ""

    No results matching ""