2015-10-26 06:09:39 +00:00
|
|
|
module RuCaptcha
|
|
|
|
class CaptchaController < ActionController::Base
|
|
|
|
def index
|
2017-03-09 08:42:43 +00:00
|
|
|
return head :ok if request.head?
|
2015-10-26 06:09:39 +00:00
|
|
|
headers['Cache-Control'] = 'no-cache, no-store, max-age=0, must-revalidate'
|
|
|
|
headers['Pragma'] = 'no-cache'
|
2017-01-22 02:16:57 +00:00
|
|
|
data = generate_rucaptcha
|
|
|
|
opts = { disposition: 'inline', type: 'image/gif' }
|
2015-10-26 06:09:39 +00:00
|
|
|
|
2016-02-28 09:27:14 +00:00
|
|
|
if Gem.win_platform?
|
2017-01-22 02:16:57 +00:00
|
|
|
send_file data, opts
|
2016-02-28 09:27:14 +00:00
|
|
|
else
|
2017-01-22 02:16:57 +00:00
|
|
|
send_data data, opts
|
2016-02-28 09:27:14 +00:00
|
|
|
end
|
2015-10-26 06:09:39 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|