diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/CaptchaConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/CaptchaConfig.java index 0be4fcaa..f5442eca 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/CaptchaConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/CaptchaConfig.java @@ -19,27 +19,27 @@ public class CaptchaConfig { DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); Properties properties = new Properties(); - // 是否有边框 默认为true 我们可以自己设置yes,no + // 是否有边框 默认为true 我们可以自己设置yes,no properties.setProperty("kaptcha.border", "yes"); - // 边框颜色 默认为Color.BLACK + // 边框颜色 默认为Color.BLACK properties.setProperty("kaptcha.border.color", "105,179,90"); - // 验证码文本字符颜色 默认为Color.BLACK + // 验证码文本字符颜色 默认为Color.BLACK properties.setProperty("kaptcha.textproducer.font.color", "blue"); - // 验证码图片宽度 默认为200 + // 验证码图片宽度 默认为200 properties.setProperty("kaptcha.image.width", "160"); - // 验证码图片高度 默认为50 + // 验证码图片高度 默认为50 properties.setProperty("kaptcha.image.height", "60"); - // 验证码文本字符大小 默认为40 + // 验证码文本字符大小 默认为40 properties.setProperty("kaptcha.textproducer.font.size", "30"); // KAPTCHA_SESSION_KEY properties.setProperty("kaptcha.session.key", "kaptchaCode"); - // 验证码文本字符间距 默认为2 + // 验证码文本字符间距 默认为2 properties.setProperty("kaptcha.textproducer.char.space", "3"); - // 验证码文本字符长度 默认为5 + // 验证码文本字符长度 默认为5 properties.setProperty("kaptcha.textproducer.char.length", "5"); - // 验证码文本字体样式 默认为new Font("Arial", 1, fontSize), new Font("Courier", 1, fontSize) + // 验证码文本字体样式 默认为new Font("Arial", 1, fontSize), new Font("Courier", 1, fontSize) properties.setProperty("kaptcha.textproducer.font.names", "Arial,Courier"); - // 验证码噪点颜色 默认为Color.BLACK + // 验证码噪点颜色 默认为Color.BLACK properties.setProperty("kaptcha.noise.color", "white"); Config config = new Config(properties); defaultKaptcha.setConfig(config); @@ -51,19 +51,33 @@ public class CaptchaConfig { DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); Properties properties = new Properties(); + // 是否有边框 默认为true 我们可以自己设置yes,no properties.setProperty("kaptcha.border", "yes"); + // 边框颜色 默认为Color.BLACK properties.setProperty("kaptcha.border.color", "105,179,90"); + // 验证码文本字符颜色 默认为Color.BLACK properties.setProperty("kaptcha.textproducer.font.color", "blue"); + // 验证码图片宽度 默认为200 properties.setProperty("kaptcha.image.width", "160"); + // 验证码图片高度 默认为50 properties.setProperty("kaptcha.image.height", "60"); - properties.setProperty("kaptcha.textproducer.font.size", "38"); + // 验证码文本字符大小 默认为40 + properties.setProperty("kaptcha.textproducer.font.size", "35"); + // KAPTCHA_SESSION_KEY properties.setProperty("kaptcha.session.key", "kaptchaCodeMath"); + // 验证码文本生成器 properties.setProperty("kaptcha.textproducer.impl", "com.ruoyi.framework.config.KaptchaTextCreator"); - properties.setProperty("kaptcha.textproducer.char.spac", "5"); + // 验证码文本字符间距 默认为2 + properties.setProperty("kaptcha.textproducer.char.space", "3"); + // 验证码文本字符长度 默认为5 properties.setProperty("kaptcha.textproducer.char.length", "6"); + // 验证码文本字体样式 默认为new Font("Arial", 1, fontSize), new Font("Courier", 1, fontSize) properties.setProperty("kaptcha.textproducer.font.names", "Arial,Courier"); + // 验证码噪点颜色 默认为Color.BLACK properties.setProperty("kaptcha.noise.color", "white"); + // 干扰实现类 properties.setProperty("kaptcha.noise.impl", "com.google.code.kaptcha.impl.NoNoise"); + // 图片样式 水纹com.google.code.kaptcha.impl.WaterRipple 鱼眼com.google.code.kaptcha.impl.FishEyeGimpy 阴影com.google.code.kaptcha.impl.ShadowGimpy properties.setProperty("kaptcha.obscurificator.impl", "com.google.code.kaptcha.impl.ShadowGimpy"); Config config = new Config(properties); defaultKaptcha.setConfig(config);