public class CaptchaRender extends Render
Modifier and Type | Field and Description |
---|---|
protected static String |
captchaName |
protected static char[] |
charArray |
protected static int |
HEIGHT |
protected static Random |
random |
protected static Font[] |
RANDOM_FONT |
protected static int |
WIDTH |
Constructor and Description |
---|
CaptchaRender() |
Modifier and Type | Method and Description |
---|---|
protected Captcha |
createCaptcha() |
protected void |
drawGraphic(String randomString,
BufferedImage image) |
protected String |
getCaptchaKeyFromCookie() |
protected Color |
getRandColor(int fc,
int bc) |
protected String |
getRandomString() |
void |
render()
生成验证码
|
static void |
setCaptchaName(String captchaName)
设置 captchaName
|
static boolean |
validate(Controller controller,
String userInputString)
校验用户输入的验证码是否正确
|
static boolean |
validate(String captchaKey,
String userInputString)
校验用户输入的验证码是否正确
|
getDevMode, getEncoding, getView, setContext, setContext, setView
protected static String captchaName
protected static final Random random
protected static final int WIDTH
protected static final int HEIGHT
protected static final char[] charArray
protected static final Font[] RANDOM_FONT
public static void setCaptchaName(String captchaName)
protected Captcha createCaptcha()
protected String getCaptchaKeyFromCookie()
protected String getRandomString()
protected void drawGraphic(String randomString, BufferedImage image)
protected Color getRandColor(int fc, int bc)
public static boolean validate(Controller controller, String userInputString)
controller
- 控制器userInputString
- 用户输入的字符串Copyright © 2018. All rights reserved.