设置验证码图片背景色为灰色
This commit is contained in:
parent
562ec7eb3d
commit
8ee0eb4aca
@ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil;
|
|||||||
import com.das.common.constant.AdminConstant;
|
import com.das.common.constant.AdminConstant;
|
||||||
import com.das.common.utils.AdminRedisTemplate;
|
import com.das.common.utils.AdminRedisTemplate;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -40,6 +41,8 @@ public class CaptchaUtils {
|
|||||||
// 使用hutool工具包中的工具类生成图片验证码
|
// 使用hutool工具包中的工具类生成图片验证码
|
||||||
//参数:宽 高 验证码位数 干扰线数量
|
//参数:宽 高 验证码位数 干扰线数量
|
||||||
CircleCaptcha circleCaptcha = CaptchaUtil.createCircleCaptcha(150, 48, 4, 20);
|
CircleCaptcha circleCaptcha = CaptchaUtil.createCircleCaptcha(150, 48, 4, 20);
|
||||||
|
//设置背景色
|
||||||
|
circleCaptcha.setBackground(Color.LIGHT_GRAY);
|
||||||
String codeValue = circleCaptcha.getCode();
|
String codeValue = circleCaptcha.getCode();
|
||||||
String imageBase64 = circleCaptcha.getImageBase64();
|
String imageBase64 = circleCaptcha.getImageBase64();
|
||||||
String verifyKey = AdminConstant.CAPTCHA_CODE_KEY + uuid;
|
String verifyKey = AdminConstant.CAPTCHA_CODE_KEY + uuid;
|
||||||
|
Loading…
Reference in New Issue
Block a user