Class: SimpleCaptcha::Middleware
- Inherits:
-
Object
- Object
- SimpleCaptcha::Middleware
- Includes:
- AudioHelpers
- Defined in:
- lib/simple_audio_captcha/middleware.rb
Instance Method Summary collapse
-
#call(env) ⇒ Object
:nodoc:.
Methods included from AudioHelpers
#generate_simple_audio_captcha, #make_audio_from_captcha, #make_audio_from_char
Instance Method Details
#call(env) ⇒ Object
:nodoc:
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/simple_audio_captcha/middleware.rb', line 5 def call(env) # :nodoc: if env["REQUEST_METHOD"] == "GET" && captcha_path?(env['PATH_INFO']) request = Rack::Request.new(env) if request.params.present? && request.params['code'].present? if request.params['audio'] && request.params['audio'].eql?('true') make_audio(env) else make_image(env) end else refresh_code(env) end else @app.call(env) end end |