[英]validating grails captcha field
i am using simple captcha in grails from grails captcha plugin. 我从grails captcha插件在grails中使用简单的验证码。 I need to validate it and this is my captcha code. 我需要验证它,这是我的验证码。 This is gsp page code. 这是gsp页面代码。
<img src="${createLink(controller: 'simpleCaptcha', action: 'captcha')}"/> <g:textField class="form-control" name="captcha" placeholder="Type captcha letters here"/>
and this is controller code. 这是控制器代码。
`def simpleCaptchaService `def simpleCaptchaService
// This is the action that handles the submission of the form with the CAPTCHA def save = { boolean captchaValid = simpleCaptchaService.validateCaptcha(params.captcha) } ` But its not validating this captcha, so please can somebody look into it and help me. //这是使用CAPTCHA def处理表单提交的操作。 。
i got solution for captcha validation in grails. 我在grails中获得了验证码验证的解决方案。 Any one needed can use this `def simpleCaptchaService 任何需要的人都可以使用这个`def simpleCaptchaService
def save = { boolean captchaValid = simpleCaptchaService.validateCaptcha(params.captcha) }` def save = {布尔值captchaValid = simpleCaptchaService.validateCaptcha(params.captcha)}`
This should be kept in controller you get the result in boolean format ie true or false get this value and validate it. 这应该保存在控制器中,您将以布尔格式获取结果,即true或false获取此值并对其进行验证。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.