class EasyCaptcha::CaptchaController
captcha controller
Public Instance Methods
captcha()
click to toggle source
send the generated image to browser
# 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
Private Instance Methods
overwrite_cache_control()
click to toggle source
Overwrite cache control for Samsung Galaxy S3 (remove no-store)
# File lib/easy_captcha/captcha_controller.rb, line 27 def overwrite_cache_control response.headers['Cache-Control'] = 'no-cache, max-age=0, must-revalidate' response.headers['Pragma'] = 'no-cache' response.headers['Expires'] = 'Fri, 01 Jan 1990 00:00:00 GMT' end