diff --git a/ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/ValidateCodeFilter.java b/ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/ValidateCodeFilter.java index 561111ba..7c933c3e 100644 --- a/ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/ValidateCodeFilter.java +++ b/ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/ValidateCodeFilter.java @@ -4,6 +4,7 @@ import java.nio.CharBuffer; import java.nio.charset.StandardCharsets; import java.util.concurrent.atomic.AtomicReference; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.cloud.gateway.filter.GatewayFilter; import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory; import org.springframework.core.io.buffer.DataBuffer; @@ -36,6 +37,9 @@ public class ValidateCodeFilter extends AbstractGatewayFilterFactory private static final String UUID = "uuid"; + @Value("${ruoyi.captchaEnabled}") + private boolean captchaEnabled; + @Override public GatewayFilter apply(Object config) { @@ -48,18 +52,17 @@ public class ValidateCodeFilter extends AbstractGatewayFilterFactory return chain.filter(exchange); } - try - { - String rspStr = resolveBodyFromRequest(request); - JSONObject obj = JSONObject.parseObject(rspStr); - validateCodeService.checkCapcha(obj.getString(CODE), obj.getString(UUID)); - } - catch (Exception e) - { - ServerHttpResponse response = exchange.getResponse(); - response.getHeaders().add("Content-Type", "application/json;charset=UTF-8"); - return exchange.getResponse().writeWith( - Mono.just(response.bufferFactory().wrap(JSON.toJSONBytes(AjaxResult.error(e.getMessage()))))); + if (captchaEnabled) { + try { + String rspStr = resolveBodyFromRequest(request); + JSONObject obj = JSONObject.parseObject(rspStr); + validateCodeService.checkCapcha(obj.getString(CODE), obj.getString(UUID)); + } catch (Exception e) { + ServerHttpResponse response = exchange.getResponse(); + response.getHeaders().add("Content-Type", "application/json;charset=UTF-8"); + return exchange.getResponse().writeWith( + Mono.just(response.bufferFactory().wrap(JSON.toJSONBytes(AjaxResult.error(e.getMessage()))))); + } } return chain.filter(exchange); }; diff --git a/ruoyi-ui/src/settings.js b/ruoyi-ui/src/settings.js index 0e74c710..ee9f8560 100644 --- a/ruoyi-ui/src/settings.js +++ b/ruoyi-ui/src/settings.js @@ -1,41 +1,45 @@ -module.exports = { - title: '若依管理系统', - - /** - * 侧边栏主题 深色主题theme-dark,浅色主题theme-light - */ - sideTheme: 'theme-dark', - - /** - * 是否系统布局配置 - */ - showSettings: false, - - /** - * 是否显示顶部导航 - */ - topNav: false, - - /** - * 是否显示 tagsView - */ - tagsView: true, - - /** - * 是否固定头部 - */ - fixedHeader: false, - - /** - * 是否显示logo - */ - sidebarLogo: true, - - /** - * @type {string | array} 'production' | ['production', 'development'] - * @description Need show err logs component. - * The default is only used in the production env - * If you want to also use it in dev, you can pass ['production', 'development'] - */ - errorLog: 'production' -} +module.exports = { + title: '若依管理系统', + + /** + * 侧边栏主题 深色主题theme-dark,浅色主题theme-light + */ + sideTheme: 'theme-dark', + + /** + * 是否系统布局配置 + */ + showSettings: false, + + /** + * 是否显示顶部导航 + */ + topNav: false, + + /** + * 是否显示 tagsView + */ + tagsView: true, + + /** + * 是否固定头部 + */ + fixedHeader: false, + + /** + * 是否显示logo + */ + sidebarLogo: true, + + /** + * @type {string | array} 'production' | ['production', 'development'] + * @description Need show err logs component. + * The default is only used in the production env + * If you want to also use it in dev, you can pass ['production', 'development'] + */ + errorLog: 'production', + /** + * 是否显示验证码 + */ + captchaEnabled:false +} diff --git a/ruoyi-ui/src/views/login.vue b/ruoyi-ui/src/views/login.vue index 8ec1aca4..71ee3583 100644 --- a/ruoyi-ui/src/views/login.vue +++ b/ruoyi-ui/src/views/login.vue @@ -1,203 +1,206 @@ - - - - - + + + + +