perf: 登录注册、找回密码都支持极验验证码和图片验证码

This commit is contained in:
xiaojunnuo
2025-09-13 23:01:14 +08:00
parent 50f92f55e2
commit 7bdde68ece
29 changed files with 446 additions and 390 deletions
@@ -36,7 +36,7 @@ export class SysPublicSettings extends BaseSettings {
captchaEnabled = false;
//验证码类型
captchaType?: string;
captchaAddonId?:string;
captchaAddonId?:number;
}
export class SysPrivateSettings extends BaseSettings {
@@ -76,9 +76,21 @@ export class AddonService extends BaseService<AddonEntity> {
}
async getAddonById(id: any, checkUserId: boolean, userId?: number): Promise<any> {
const ctx = {
http: http,
logger: logger,
utils: utils,
};
if (!id){
//使用图片验证码
return await newAddon("captcha", "image", {},ctx);
}
const entity = await this.info(id);
if (entity == null) {
throw new Error(`该Addon配置不存在,请确认是否已被删除:id=${id}`);
//使用图片验证码
return await newAddon("captcha", "image", {},ctx);
}
if (checkUserId) {
if (userId == null) {
@@ -89,17 +101,12 @@ export class AddonService extends BaseService<AddonEntity> {
}
}
// const access = accessRegistry.get(entity.type);
const setting = JSON.parse(entity.setting ??"{}")
const input = {
id: entity.id,
...setting,
};
const ctx = {
http: http,
logger: logger,
utils: utils,
};
return await newAddon(entity.addonType, entity.type, input,ctx);
}