forked from Yara724/api
FIX Catcha
This commit is contained in:
@@ -12,9 +12,18 @@ export class LoginActorDto {
|
||||
@ApiProperty({})
|
||||
password: string;
|
||||
|
||||
@ApiProperty({
|
||||
example: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
|
||||
description: "Captcha id from GET /actor/captcha.",
|
||||
})
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
@MaxLength(64)
|
||||
captchaId: string;
|
||||
|
||||
@ApiProperty({
|
||||
example: "a7bx2",
|
||||
description: "Captcha text from GET /actor/captcha (same username + role).",
|
||||
description: "Characters shown in the captcha image.",
|
||||
})
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
import { ApiProperty } from "@nestjs/swagger";
|
||||
|
||||
export class CaptchaResponseDto {
|
||||
@ApiProperty({
|
||||
description: "Captcha challenge id — send back with POST /actor/login.",
|
||||
example: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
|
||||
})
|
||||
captchaId: string;
|
||||
|
||||
@ApiProperty({
|
||||
description:
|
||||
"SVG captcha as a data URI — use as `<img src={image} />` in the frontend. " +
|
||||
"Swagger shows this as text only; paste the full string into a browser tab, " +
|
||||
"or call GET /actor/captcha?format=raw to view the image directly.",
|
||||
"SVG captcha as a data URI — use as `<img src={image} />` in the frontend.",
|
||||
example: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iLi4u",
|
||||
})
|
||||
image: string;
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
|
||||
import { IsEnum, IsIn, IsNotEmpty, IsOptional, IsString, MaxLength } from "class-validator";
|
||||
import { RoleEnum } from "src/Types&Enums/role.enum";
|
||||
|
||||
export class GetActorCaptchaQueryDto {
|
||||
@ApiProperty({
|
||||
example: "expert@gmail.com",
|
||||
description: "Actor email / username",
|
||||
})
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
@MaxLength(128)
|
||||
username: string;
|
||||
|
||||
@ApiProperty({
|
||||
enum: RoleEnum,
|
||||
example: RoleEnum.EXPERT,
|
||||
description: "Actor role",
|
||||
})
|
||||
@IsEnum(RoleEnum)
|
||||
role: RoleEnum;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
enum: ["json", "raw"],
|
||||
default: "json",
|
||||
description:
|
||||
"Use `raw` to open the captcha directly in the browser (image/svg+xml). " +
|
||||
"Default `json` returns `{ image, expiresAt }` for the frontend.",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsIn(["json", "raw"])
|
||||
format?: "json" | "raw";
|
||||
}
|
||||
15
src/auth/dto/get-captcha-image-query.dto.ts
Normal file
15
src/auth/dto/get-captcha-image-query.dto.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { ApiPropertyOptional } from "@nestjs/swagger";
|
||||
import { IsIn, IsOptional } from "class-validator";
|
||||
|
||||
export class GetCaptchaImageQueryDto {
|
||||
@ApiPropertyOptional({
|
||||
enum: ["json", "raw"],
|
||||
default: "json",
|
||||
description:
|
||||
"On GET /actor/captcha, use `raw` to return image/svg+xml (for browser preview). " +
|
||||
"The JSON response includes `captchaId` either way.",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsIn(["json", "raw"])
|
||||
format?: "json" | "raw";
|
||||
}
|
||||
Reference in New Issue
Block a user