| | |
| | | import org.springframework.core.io.buffer.DataBufferUtils;
|
| | | import org.springframework.http.server.reactive.ServerHttpRequest;
|
| | | import org.springframework.stereotype.Component;
|
| | | import com.alibaba.fastjson.JSONObject;
|
| | | import com.alibaba.fastjson2.JSON;
|
| | | import com.alibaba.fastjson2.JSONObject;
|
| | | import com.ruoyi.common.core.utils.ServletUtils;
|
| | | import com.ruoyi.common.core.utils.StringUtils;
|
| | | import com.ruoyi.gateway.config.properties.CaptchaProperties;
|
| | |
| | |
|
| | | /**
|
| | | * 验证码过滤器
|
| | | * |
| | | *
|
| | | * @author ruoyi
|
| | | */
|
| | | @Component
|
| | |
| | | ServerHttpRequest request = exchange.getRequest();
|
| | |
|
| | | // 非登录/注册请求或验证码关闭,不处理
|
| | | if (!StringUtils.containsAnyIgnoreCase(request.getURI().getPath(), VALIDATE_URL) || !captchaProperties.getEnabled())
|
| | | if (!StringUtils.equalsAnyIgnoreCase(request.getURI().getPath(), VALIDATE_URL) || !captchaProperties.getEnabled())
|
| | | {
|
| | | return chain.filter(exchange);
|
| | | }
|
| | |
| | | try
|
| | | {
|
| | | String rspStr = resolveBodyFromRequest(request);
|
| | | JSONObject obj = JSONObject.parseObject(rspStr);
|
| | | validateCodeService.checkCapcha(obj.getString(CODE), obj.getString(UUID));
|
| | | JSONObject obj = JSON.parseObject(rspStr);
|
| | | validateCodeService.checkCaptcha(obj.getString(CODE), obj.getString(UUID));
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|