2013-01-10 15:06:12 +01:00
|
|
|
# ReallySimpleCaptcha
|
|
|
|
|
2013-01-11 11:53:54 +01:00
|
|
|
ReallySimpleCaptcha is just another captcha gem.
|
2013-01-10 15:06:12 +01:00
|
|
|
|
2013-01-11 11:53:54 +01:00
|
|
|
## Requirements
|
2013-01-10 15:06:12 +01:00
|
|
|
|
2013-01-11 11:53:54 +01:00
|
|
|
- Rails >= 3
|
|
|
|
- RMagick
|
2013-01-10 15:06:12 +01:00
|
|
|
|
2013-01-11 11:53:54 +01:00
|
|
|
## Usage
|
2013-01-10 15:06:12 +01:00
|
|
|
|
2013-01-11 11:53:54 +01:00
|
|
|
### PlainCaptcha
|
2013-01-10 15:06:12 +01:00
|
|
|
|
2013-01-11 11:53:54 +01:00
|
|
|
The plain captcha display an image with distorted text and a text field.
|
2013-01-10 15:06:12 +01:00
|
|
|
|
2013-01-11 11:53:54 +01:00
|
|
|
To use it, add this line in the view file within the form tag :
|
|
|
|
```
|
|
|
|
<%= plain_captcha_tag %>
|
|
|
|
```
|
2013-01-10 15:06:12 +01:00
|
|
|
|
2013-01-11 11:53:54 +01:00
|
|
|
To verify the captcha in the controller, use :
|
|
|
|
```
|
|
|
|
plain_captcha_valid?
|
|
|
|
```
|
2013-01-10 15:06:12 +01:00
|
|
|
|
2013-01-11 11:53:54 +01:00
|
|
|
### ReverseCaptcha
|
|
|
|
|
|
|
|
The reverse captcha add a text field hidden with CSS to trick bot into filling this field.
|
|
|
|
|
|
|
|
To use it, add this line in the view file within the form tag :
|
|
|
|
```
|
|
|
|
<%= reverse_captcha_tag %>
|
|
|
|
```
|
|
|
|
|
|
|
|
To verify the captcha in the controller, use :
|
|
|
|
```
|
|
|
|
reverse_captcha_valid?
|
|
|
|
```
|
|
|
|
|
|
|
|
## Configuration
|
|
|
|
|
|
|
|
ReverseCaptcha and PlainCaptcha must be configured separately.
|
|
|
|
|
|
|
|
### PlainCaptcha
|
|
|
|
```
|
|
|
|
ReallySimpleCaptcha::Captcha::PlainCaptcha.configure do |config|
|
2013-01-11 14:40:58 +01:00
|
|
|
config.field_name = :plain_captcha
|
2013-01-11 11:53:54 +01:00
|
|
|
|
2013-01-11 14:40:58 +01:00
|
|
|
config.text_length = 6
|
2013-01-11 11:53:54 +01:00
|
|
|
# colors
|
|
|
|
config.fill = 'darkblue'
|
|
|
|
config.background_color = 'white'
|
|
|
|
# font size
|
|
|
|
config.pointsize = 22
|
|
|
|
# image modification options
|
2013-01-11 14:58:37 +01:00
|
|
|
config.width = 120
|
|
|
|
config.height = 40
|
2013-01-11 15:25:18 +01:00
|
|
|
config.implode_amount = 0.3
|
2013-01-11 11:53:54 +01:00
|
|
|
config.wave_amplitude = 4.0
|
|
|
|
config.wave_length = 60.0
|
|
|
|
end
|
|
|
|
```
|
2013-01-10 15:06:12 +01:00
|
|
|
|
2013-01-11 11:53:54 +01:00
|
|
|
### ReverseCaptcha
|
|
|
|
```
|
|
|
|
ReallySimpleCaptcha::Captcha::ReverseCaptcha.configure do |config|
|
2013-01-11 14:40:58 +01:00
|
|
|
config.field_name = :reverse_captcha
|
2013-01-11 11:53:54 +01:00
|
|
|
end
|
|
|
|
```
|
2013-01-10 15:06:12 +01:00
|
|
|
|
|
|
|
## Contributing
|
|
|
|
|
|
|
|
1. Fork it
|
|
|
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
|
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
|
|
4. Push to the branch (`git push origin my-new-feature`)
|
|
|
|
5. Create new Pull Request
|
2013-01-15 15:54:16 +01:00
|
|
|
|
|
|
|
## License
|
|
|
|
|
|
|
|
ReallySimpleCaptcha is released under the AGPLv3.
|
|
|
|
Copyright (c) 2013 La Fourmi Immo.
|