1
0
forked from Yara724/api
This commit is contained in:
SepehrYahyaee
2026-05-24 10:10:17 +03:30
parent 91221a6848
commit af875a4773
20 changed files with 439 additions and 9 deletions

View File

@@ -18,6 +18,7 @@ import {
RegisterDtoRs,
} from "src/auth/dto/actor/register.actor.dto";
import { StateListDtoRs } from "src/auth/dto/actor/states.dto";
import { CaptchaAccountService } from "src/auth/auth-services/captcha-account.service";
import { ClientDbService } from "src/client/entities/db-service/client.db.service";
import { RoleEnum } from "src/Types&Enums/role.enum";
import { UserType } from "src/Types&Enums/userType.enum";
@@ -52,6 +53,7 @@ export class ActorAuthService {
// private readonly mailService: MailService, // Mailer disabled not used
private readonly clientDbService: ClientDbService,
private readonly otpService: OtpGeneratorService,
private readonly captchaAccountService: CaptchaAccountService,
) {}
// TODO convrt to class for dynamic controller
@@ -176,6 +178,13 @@ export class ActorAuthService {
if (typeof password !== "string" || !password) {
throw new BadRequestException("password is required");
}
const captcha =
typeof body?.captcha === "string" ? body.captcha : undefined;
await this.captchaAccountService.verifyActorCaptcha(
username,
role,
captcha,
);
const actor = await this.validateActor(username, password, role);
return this.issueActorTokens(actor);
}