@Controller
public class CaptchaImageCreateController
extends Object
This class is used to generate image. The image config is in common-config-sudoor.xml.
Validation In Application :
protected void validateCaptcha(
HttpServletRequest request,
Object command,
Errors errors) throws Exception {
String captchaId = (String) request.getSession().getAttribute(Constants.KAPTCHA_SESSION_KEY);
String response = ((RegistrationVO) command).getCaptchaResponse();
if (log.isDebugEnabled()) {
log.debug("Validating captcha response: '" + response + "'");
}
if (!StringUtils.equalsIgnoreCase(captchaId, response)) {
errors.rejectValue("captchaResponse", "error.invalidcaptcha",
"Invalid Entry");
}
}
- 作者:
- xufucheng