
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
A simple captcha implementation for Rails 5+ based on RMagick.
This (kandr-easy_captcha
) is a fork of
EasyCaptcha (easy_captcha
) with Rails 5+ support. This fork is
maintained by Karl Wilbur/K&R Software (karl@kandrsoftware.com).
RMagick should be included in your Gemfile
gem 'rmagick'
for Java/JRuby you can use
gem 'rmagick4j'
add to Gemfile
gem 'kandr-easy_captcha', require: 'easy_captcha'
after running bundle install
, execute
rails g easy_captcha:install
You can configure easy_captcha
in config/initializers/easy_captcha.rb
, if
you want to customize the default configuration
EasyCaptcha.setup do |config|
# #####
# # Cache
# config.cache = true
# Cache temp dir from Rails.root
# config.cache_temp_dir = Rails.root.join('tmp', 'captchas')
# Cache size
# config.cache_size = 500
# Cache expire
# config.cache_expire = 1.day
# #####
# # CAPTCHA
# # Chars available for CAPTCHA
# config.captcha_character_pool = %w(2 3 4 5 6 7 9 A C D E F G H J K L M N P Q R S T U X Y Z)
#
# # Length of CAPTCHA string
# config.captcha_character_count = 6
# config.captcha_character_count_max = 6
# config.captcha_character_count_min = 6
#
# # CAPTCHA Image dimensions
# config.captcha_image_height = 40
#####
# Image
# config.captcha_image_height = 40
# config.captcha_image_width = 140
# #####
# # eSpeak
# # Enable eSpeak using all defaults:
# config.espeak = true
# # Enable eSpeak using custom config:
# config.espeak do |espeak|
# Amplitude, 0 to 200
# espeak.amplitude = 80..120
# Word gap. Pause between words
# espeak.gap = 80
# Pitch adjustment, 0 to 99
# espeak.pitch = 30..70
# Use voice file of this name from espeak-data/voices
# espeak.voice = nil
# end
# #####
# # Generator
# config.generator :default do |generator|
# # # Backgound
# # # Ignored (set as `none`) when using custom background image or fill
# # generator.background_color = '#FFFFFF'
# # An instance of a `Fill` class. RMagick supplies three `Fill` classes:
# # - `HatchFill`
# # - `GradientFill`
# # - `TextureFill`.
# generator.background_fill = nil
# # # Custom image to be used for CAPTCHA background
# # generator.background_image = nil
# # Blur
# # generator.blur = true
# # generator.blur_radius = 1
# # generator.blur_sigma = 2
# # # Font
# # generator.font_size = 24
# # generator.font_fill_color = '#333333'
# # generator.font_stroke_color = '#000000'
# # generator.font_stroke = 0
# # generator.font_family = File.expand_path('../../resources/afont.ttf', __FILE__)
# # # Implode (the "funhouse mirror" effect; negative values allowed)
# # generator.implode = 0.1
# # # Sketch
# # generator.sketch = true
# # generator.sketch_radius = 0.0
# # generator.sketch_sigma = 1.0
# # Wave
# # generator.wave = true
# # generator.wave_length = (60..100)
# # generator.wave_amplitude = (3..5)
# end
end
It is strongly recommended to enable caching. You can see the three paramters which you have to fill in your config file below.
EasyCaptcha.setup do |config|
# Cache
config.cache = true
# Cache temp dir from Rails.root
config.cache_temp_dir = Rails.root.join('tmp', 'captchas')
# Cache expire
config.cache_expire = 1.day
# Cache size
# config.cache_size = 500
end
<% form_tag '/' do %>
<% if request.post? %>
<p><%= valid_captcha?(params[:captcha]) ? 'valid' : 'invalid' %> captcha</p>
<% end %>
<p><%= captcha_tag %></p>
<p><%= text_field_tag :captcha %></p>
<p><%= submit_tag 'Validate' %></p>
<% end %>
You find an example app under: http://github.com/phatworx/easy_captcha_example
See the CHANGELOG.md
Rakefile
, EasyCaptcha::VERSION
, or CHANGELOG
EasyCAPTCHA is licensed under The MIT License.
Copyright (c) 2010-2021 Marco Scholl; K&R Software, LLC.; and EasyCAPTCHA Contributors.
See LICENSE.txt
and CHANGELOG.md
for further details.
FAQs
Unknown package
We found that kandr-easy_captcha demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.