diff --git a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application.Contracts/Dtos/Account/CaptchaImageDto.cs b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application.Contracts/Dtos/Account/CaptchaImageDto.cs index 26254018..19224f72 100644 --- a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application.Contracts/Dtos/Account/CaptchaImageDto.cs +++ b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application.Contracts/Dtos/Account/CaptchaImageDto.cs @@ -4,5 +4,7 @@ { public Guid Uuid { get; set; } = Guid.Empty; public byte[] Img { get; set; } + + public bool IsEnableCaptcha { get; set; } } } diff --git a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/AccountService.cs b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/AccountService.cs index d1d8d7ca..2830a9fe 100644 --- a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/AccountService.cs +++ b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/AccountService.cs @@ -157,7 +157,8 @@ namespace Yi.Framework.Rbac.Application.Services { var uuid = _guidGenerator.Create(); var captcha = _captcha.Generate(uuid.ToString()); - return new CaptchaImageDto { Img = captcha.Bytes, Uuid = uuid }; + var enableCaptcha = _rbacOptions.EnableCaptcha; + return new CaptchaImageDto { Img = captcha.Bytes, Uuid = uuid,IsEnableCaptcha= enableCaptcha }; } /// diff --git a/Yi.RuoYi.Vue3/src/views/login.vue b/Yi.RuoYi.Vue3/src/views/login.vue index e9c8433e..037c5a37 100644 --- a/Yi.RuoYi.Vue3/src/views/login.vue +++ b/Yi.RuoYi.Vue3/src/views/login.vue @@ -113,7 +113,7 @@ const loginRules = { const codeUrl = ref(""); const loading = ref(false); // 验证码开关 -const captchaEnabled = ref(true); +const captchaEnabled = ref(false); // 注册开关 const register = ref(false); const redirect = ref(undefined); @@ -157,7 +157,7 @@ function handleLogin() { function getCode() { getCodeImg().then(res => { - captchaEnabled.value = res.captchaEnabled === undefined ? true : res.captchaEnabled; + captchaEnabled.value = res.data.isEnableCaptcha === undefined ? true : res.data.isEnableCaptcha; if (captchaEnabled.value) { codeUrl.value = "data:image/gif;base64," + res.data.img; loginForm.value.uuid = res.data.uuid; diff --git a/Yi.RuoYi.Vue3/src/views/register.vue b/Yi.RuoYi.Vue3/src/views/register.vue index cc4f6e46..9d6e6ab8 100644 --- a/Yi.RuoYi.Vue3/src/views/register.vue +++ b/Yi.RuoYi.Vue3/src/views/register.vue @@ -142,7 +142,7 @@ function handleRegister() { function getCode() { getCodeImg().then(res => { - captchaEnabled.value = res.captchaEnabled === undefined ? true : res.captchaEnabled; + captchaEnabled.value = res.data.isEnableCaptcha === undefined ? true : res.data.isEnableCaptcha; if (captchaEnabled.value) { codeUrl.value = "data:image/gif;base64," + res.img; registerForm.value.uuid = res.uuid;