jfinal重写图形验证码,生成纯数字验证码(jfinal-3.3)。
程序员文章站
2022-06-14 19:52:19
...
public class CaptchaSmallRender extends CaptchaRender {
// 验证码随机字符数组
protected static final char[] charArray = "0123456789".toCharArray();
@Override
protected String getRandomString() {
char[] randomChars = new char[4];
for (int i = 0; i < randomChars.length; i++) {
randomChars[i] = charArray[random.nextInt(charArray.length)];
}
return String.valueOf(randomChars);
}
}
//@ValidateTOKEN(isValidate = false)
public void captcha() {
render(new CaptchaSmallRender());
}
上一篇: 数据收集之DataX
下一篇: Django——对IP访问频率进行限制