插件地址:
https://github.com/eshopworks/simple_captcha
(1)入门篇:
安装插件-->
script/plugin install git://github.com/eshopworks/simple_captcha.git
执行-->
rake simple_captcha:setup
在routes.rb中添加-->
map.simple_captcha '/simple_captcha/:action', :controller => 'simple_captcha'
你还需要在application_controller.rb中加入-->
ApplicationController < ActionController::Base
include SimpleCaptcha::ControllerHelpers
end
根据我的项目,需要在app/views/events/new.html.erb的form中加上-->
<p>
<%= show_simple_captcha(:object => 'event') %>
</p>
在app/models/event.rb中添加-->
class Event < ActiveRecord::Base
apply_simple_captcha
end
将app/controllers/events_controller.rb中的create action-->
if @event.save
改为-->
if @event.save_with_captcha
(2)进阶篇
在插件下载的Wiki里,有一个链接,是关于此插件的详细用法的,如下-->
Simple Captcha:
http://expressica.com/simple_captcha/
如需要进阶使用,可以根据里面的说明进行相关修改,如->
引用
:label
provides the custom below the image, default is “(type the code from the image)”
:image_style
Provides the specific image style for the captcha image.
There are eight different styles available with the plugin as…
* simply_blue
* simply_red
* simply_green
* embosed_silver
* all_black
* distorted_black
* charcoal_grey
* almost_invisible
Default is ’simply_blye’
You can also specify ‘random’ to select the random image style.
:distortion
Handles the complexity of the image. The :distortion can be set to ‘low’, ‘medium’
or ‘high’. Default is ‘low’.
:code_type
Handles the text of the captcha image. Available options are ‘numeric’ or ‘alphabetic’.
Default is ‘alphabetic’.
:object
the name of the object of the model class, to implement the model based captcha.
看看我的应用-->
在user.rb中
apply_simple_captcha :message => "image and text were different", :add_to_base => true
在对应的new.html.erb里
<p>验证码</p>
<%= show_simple_captcha(:object => 'user', :code_type => 'numeric', :image_style => 'all_black', :distortion => 'low',:label => "(请正确输入图片中的数字?)") %>
因此它看起来应该是这样的-->
(3)实操篇:
从上图可以看到,这种样式其实是很丑的.而且也没有刷新验证码的按钮.反正就是不顺眼.废话不说了,看看netfork兄的文章吧.
验证码生成换成simple_captcha了:
http://netfork.iteye.com/blog/434099
以上东东只供记录.
分享到:
相关推荐
本项目针对字符型图片验证码,使用tensorflow实现卷积神经网络,进行验证码识别。 项目封装了比较通用的**校验、训练、验证、识别、API模块**,极大的减少了识别字符型验证码花费的时间和精力 1.1 关于验证码识别...
gem 'simple_captcha_audio' 然后执行: $ bundle 或将其自己安装为: $ gem install simple_captcha_audio 用法 该扩展程序将另一个参数添加到图像生成URL,以促进针对同一验证码的音频文件的生成。 假设...
英文版验证码数据集,可以用于算法的验证,可以参考https://blog.csdn.net/c_he_n/article/details/122213798?spm=1001.2014.3001.5501 。
针对字符型图片验证码,使用tensorflow实现卷积神经网络,进行验证码识别。项目封装了比较通用的校验、训练、验证、识别、API模块,极大的减少了识别字符型验证码花费的时间和精力。
12306_captcha, CNN对12306、sina、baidu的验证码破解。
此nginx模块可直接生成验证码和验证验证码,可在nginx配置中自定义验证码大小、长度、字体、过期时间等。此项目无需版权,可自由下载使用或二次开发。 安装方法: 1. $ cp ngx_...
captcha, simple captcha for golang (go验证码生成器)
invisible_captcha, 针对RoR应用的Unobtrusive和灵活的垃圾邮件保护 不可见的验证码 Rails 应用程序的简单和灵活的垃圾邮件保护解决方案。不可见的Captcha提供了不同的技术来保护你的应用程序免受垃圾干扰。主保护是...
有的时候我们使用一些自动化脚本需要自动登录到一些网站做一些操作,提高工作的效率。但**验证码**是一个拦路虎,面对各种复杂的甚至连人都可能搞错的验证码,机器的自动识别...本代码可以自动生成发票查验所需验证码。
php验证码
简单的验证码图片点击后实现图片刷新,并且进行输入框失去焦点后验证输入是否正确。
Burp suite图形验证码插件 注:需要配合验证码识别接口可用,本插件仅提供转发功能,不提供验证码识别
pytorch实现文字点选、选字、选择文字验证码识别_中文字检测识别.zip
基于rmagick的rails 3的简单验证码实现 经过Rails 3.2.8的测试 安装 添加到Gemfile gem 'easy_captcha' gem 'rmagick' 对于Java,您可以使用 gem 'rmagick4j' 捆绑执行后 rails g easy_captcha: install 配置 ...
节点TwoCaptcha 节点TwoCaptcha是一个Javascript包2Captcha - 。 安装 赶紧跑: npm install @infosimples/node_two_captcha JSDoc文档可以在找到 ...client = new Client ( 'your_2captcha_key' , { ti
JavaScript应用实例-JD_Captcha_Test.js
简单验证码Java制作的简单验证码图像生成器!用法示例import me.brennan.captcha.ImageGenerator ;import javax.imageio.ImageIO ;import java.io.FileOutputStream ;public class Test { public static void main ...
cnn_captcha 使用CNN通过张量流识别验证码。本项目针对字符型图片验证码,使用张量流实现卷积神经网络,进行验证码识别。项目封装了比较通用的校验,训练,验证,识别,API模块,极大地减少了识别字符型验证码花费...
java图形验证码生成,支持自定义长度及文本类型
python库,解压后可用。 资源全名:Redj_Captcha-1.1.3-py3-none-any.whl