class SimpleCaptchaReloaded::Config
Public Class Methods
generate_challenge()
click to toggle source
# File lib/simple_captcha_reloaded/config.rb, line 27 def self.generate_challenge key = SecureRandom.uuid value = length.times.map do |i| characters.sample end [ key, value.join ] end
image_url(code, request)
click to toggle source
# File lib/simple_captcha_reloaded/config.rb, line 8 def self.image_url(code, request) time = Time.now.to_i path = captcha_path + "?code=#{code}&time=#{time}" if request && defined?(request.protocol) "#{request.protocol}#{request.host_with_port}#{ENV['RAILS_RELATIVE_URL_ROOT']}#{path}" else "#{ENV['RAILS_RELATIVE_URL_ROOT']}#{path}" end end
refresh_url(request, id)
click to toggle source
# File lib/simple_captcha_reloaded/config.rb, line 18 def self.refresh_url(request, id) path = captcha_path + "?id=#{id}" if request && defined?(request.protocol) "#{request.protocol}#{request.host_with_port}#{ENV['RAILS_RELATIVE_URL_ROOT']}#{path}" else "#{ENV['RAILS_RELATIVE_URL_ROOT']}#{path}" end end