From: Ben L. (JIRA) <jir...@ob...> - 2007-12-04 12:26:44
|
Ajax-ify ERCaptcha ------------------ Key: WONDER-52 URL: http://issues.objectstyle.org/jira/browse/WONDER-52 Project: Project Wonder Issue Type: Bug Reporter: Ben Lawson Assigned To: Anjo Krank Priority: Minor Adding a method that updates the captcha without appending all the extra appendToResponse code to allow Ajax updates of ERCaptcha, and preserve other form data: public WOActionResults ajaxResetCaptcha(WOContext context) { byte[] captchaChallengeAsJpeg = null; ByteArrayOutputStream captchaOutputStream = new ByteArrayOutputStream(); try { BufferedImage challenge = ERCaptcha.captchaService().getImageChallengeForID(context.elementID()); JPEGImageEncoder captchaEncoder = JPEGCodec.createJPEGEncoder(captchaOutputStream); captchaEncoder.encode(challenge); _captcha = new NSData(captchaOutputStream.toByteArray()); } catch (Throwable e) { log.error("Failed to create JPEG for Captcha.", e); } return null; } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.objectstyle.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |