From d46af13a2e13f296fc1508179e64e266fefbba34 Mon Sep 17 00:00:00 2001 From: PIGCLOUD Date: Sat, 15 Aug 2026 09:40:45 +0800 Subject: [PATCH] =?UTF-8?q?feat(auth):=20=E4=BC=98=E5=8C=96=E5=9B=BE?= =?UTF-8?q?=E5=BD=A2=E9=AA=8C=E8=AF=81=E7=A0=81=E7=94=9F=E6=88=90=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E6=96=B0=E5=A2=9E=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E9=A2=9C=E8=89=B2=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit af900df10d6e9df4b9812332f126c2e96474722e) --- .../pigx/auth/endpoint/ImageCodeEndpoint.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pigx-auth/src/main/java/com/pig4cloud/pigx/auth/endpoint/ImageCodeEndpoint.java b/pigx-auth/src/main/java/com/pig4cloud/pigx/auth/endpoint/ImageCodeEndpoint.java index cf5a53e55..1bab2f344 100644 --- a/pigx-auth/src/main/java/com/pig4cloud/pigx/auth/endpoint/ImageCodeEndpoint.java +++ b/pigx-auth/src/main/java/com/pig4cloud/pigx/auth/endpoint/ImageCodeEndpoint.java @@ -18,6 +18,8 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.awt.Color; + /** * 验证码相关的接口 * @@ -39,7 +41,7 @@ public class ImageCodeEndpoint { @SneakyThrows @GetMapping("/image") public void image(String randomStr, HttpServletResponse response) { - ArithmeticCaptcha captcha = new ArithmeticCaptcha(DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT); + ArithmeticCaptcha captcha = createCaptcha(); String result = captcha.text(); @@ -53,6 +55,15 @@ public class ImageCodeEndpoint { captcha.out(response.getOutputStream()); } + static ArithmeticCaptcha createCaptcha() { + return new ArithmeticCaptcha(DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT) { + @Override + protected Color color() { + return Color.BLACK; + } + }; + } + /** * 行为 创建滑块图形验证码 */