From b59dfbc3fd68e5cff6acb48ebd8d8bf7731b40a7 Mon Sep 17 00:00:00 2001 From: Po <448443959@qq.com> Date: Mon, 14 Oct 2024 16:49:33 +0800 Subject: [PATCH] =?UTF-8?q?Ruoyi=E6=98=AF=E5=90=A6=E5=90=AF=E7=94=A8?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E7=A0=81=E7=94=B1=E5=90=8E=E5=8F=B0appsettin?= =?UTF-8?q?gs.json=E5=86=B3=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/Account/CaptchaImageDto.cs | 2 ++ .../Yi.Framework.Rbac.Application/Services/AccountService.cs | 3 ++- Yi.RuoYi.Vue3/src/views/login.vue | 4 ++-- Yi.RuoYi.Vue3/src/views/register.vue | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) 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;