用户登录问题修改

This commit is contained in:
jiang 2024-09-10 18:09:06 +08:00
parent e51de30aee
commit 764417218a
1 changed files with 3 additions and 2 deletions

View File

@ -5,10 +5,11 @@ import java.security.SecureRandom;
/**
* 验证码生成实用类
* 提供生成数字字母和字母数字混合的验证码的功能
* @author bonus
*/
public class VerificationCodeUtils {
// 安全的随机数生成器用于生成随机验证码
private static final SecureRandom secureRandom = new SecureRandom();
private static final SecureRandom SECURE_RANDOM = new SecureRandom();
// 验证码的默认长度
private static final int CODE_LENGTH = 6;
// 数字字符集
@ -59,7 +60,7 @@ public class VerificationCodeUtils {
// 生成验证码长度为CODE_LENGTH
for (int i = 0; i < CODE_LENGTH; i++) {
// 随机选择字符集中的一个字符并添加到验证码字符串中
int index = secureRandom.nextInt(characters.length());
int index = SECURE_RANDOM.nextInt(characters.length());
verificationCode.append(characters.charAt(index));
}