rucaptcha/app/controllers/ru_captcha/captcha_controller.rb

18 lines
557 B
Ruby

module RuCaptcha
class CaptchaController < ActionController::Base
def index
return head :ok if request.head?
headers['Cache-Control'] = 'no-cache, no-store, max-age=0, must-revalidate'
headers['Pragma'] = 'no-cache'
if params[:format] == "wav" and RuCaptcha.espeak?
data = generate_speech_rucaptcha
opts = { disposition: 'inline', type: 'audio/wav' }
else
data = generate_rucaptcha
opts = { disposition: 'inline', type: 'image/gif' }
end
send_data data, opts
end
end
end