原文地址:http://my.oschina.net/65304586/blog/168130
安装
在config/buildConfig.groovy下plugin配置
plugins {
// plugins for the build system only
compile ":simple-captcha:0.9.4"
}
配置
simpleCaptcha {
// font size used in CAPTCHA images
fontSize = 20
height = 150
width = 200
// number of characters in CAPTCHA text
length = 6
// amount of space between the bottom of the CAPTCHA text and the bottom of the CAPTCHA image
bottomPadding = 16
// distance between the diagonal lines used to obfuscate the text
lineSpacing = 10
// the charcters shown in the CAPTCHA text must be one of the following
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
// this param will be passed as the first argument to this java.awt.Font constructor
// http://docs.oracle.com/javase/6/docs/api/java/awt/Font.html#Font(java.lang.String,%20int,%20int)
font = "Serif"
}
修改login.gsp
<input type="text" name="captcha" class="form-control-Code"/>
<img src="${createLink(controller: 'simpleCaptcha', action: 'captcha')}"/>
修改loginController
def save() {
boolean captchaValid = simpleCaptchaService.validateCaptcha(params.captcha)
if(!captchaValid) {
flash.message = "验证码错误"
render(view: "login")
return
}
def userInstance = new User(params)
}
分享到:
相关推荐
elasticsearch-grails-plugin, 恢复的ElasticSearch grails插件 Elasticsearch插件插件这个项目是一个基于Elasticsearch的插件,这个项目是基于的人完成的伟大工作的。你为什么想要为原来的Elasticsearch插件提供...
Grails Web 应用框架:grails-core
prestige.zip,android的mvc模式,android的代码生成驱动的mvc模式。
grails-1.0 中文参考文档 网上收集而来,对 e 文不太熟悉的朋友可以参考一下,有些翻译的不好理解,最好对照着官方的e 文的参考文档
groovy-grails-tool-suite-3.6.4.RELEASE-e4.4.2-win32-x86_64.part1 共两个压缩包,解压后将扩展名.zip.bak改为.zip再次解压。
groovy-grails-tool-suite-3.6.4.RELEASE-e4.4.2-win32-x86_64.part2 共两个包,解压后需要将扩展名.zip.bak改名为.zip重新解压。 http://dist.springsource.com/release/STS/3.8.1.RELEASE/dist/ e4.6/spring-tool-...
Groovy&Grails - 指南.pptGroovy&Grails - 指南.pptGroovy&Grails - 指南.pptGroovy&Grails - 指南.pptGroovy&Grails - 指南.ppt
grails 中文文档+grails-fckeditor-0.9.5.zip插件
classpath " org.grails:grails-gradle-plugin:2.1.2 " } } version " 0.1 " group " example " apply plugin : " grails " repositories { grails . central() // creates a maven repo for the Grails Central ...
Grails-2.4.4-用户手册
grails-4.0.4.zip
Grails是一个full-stack框架,它借助于核心技术与相关的插件(plug-in)来解决Web开发中方方面面的问题,其中包括: 易于使用的基于Hibernate的对象-关系映射(ORM)层 称为Groovy Server Pages (GSP)的表现层技术 ...
grails核心源码,版本2.2.2,可以给对grails开发感兴趣的朋友做学习参考。
grails-docs-2.0.0
grails-spring-websocket ils子 2.4.x 3.2.7+ 2.5.x 4.0.0+ 安装 要将插件安装到Grails应用程序中,请将以下行添加到build.gradle依赖项部分: implementation "org.grails.plugins:grails-spring-websocket:...
grails-quartz-0.4.1 插件,直接安装
Grails 4 ships with the following dependency upgrades: Groovy 2.5.6 GORM 7 and Hibernate 5.4 (now the default version of Hibernate for new applications) Spring Framework 5.1.5 Spring Boot 2.1.3 ...
grails-1.2.2.zip
漏洞修补好象是传asp等后缀名的时候,生成的是nba的后缀。上传原来很简单在后缀加个空格就可以了
grails-2.3.6