Class: EasyCaptcha::CaptchaController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- EasyCaptcha::CaptchaController
- Defined in:
- lib/easy_captcha/captcha_controller.rb
Overview
captcha controller
Instance Method Summary collapse
-
#captcha ⇒ Object
send the generated image to browser.
Instance Method Details
#captcha ⇒ Object
send the generated image to browser
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/easy_captcha/captcha_controller.rb', line 9 def captcha # Reset the CAPTCHA code on request session.delete(:captcha) # Generate the new CAPTCHA code generate_captcha_code # Generate and output the CAPTCHA image/audio file if (params[:format] == 'wav') && EasyCaptcha.espeak? send_data(generate_speech_captcha, disposition: 'inline', type: 'audio/wav') else send_data(generate_captcha, disposition: 'inline', type: 'image/png') end end |