lib/simple_captcha/middleware.rb in simple_captcha2-0.3.3 vs lib/simple_captcha/middleware.rb in simple_captcha2-0.3.4
- old
+ new
@@ -77,15 +77,16 @@
options[:field_value] = set_simple_captcha_data(key, options)
url = simple_captcha_image_url(key, options)
status = 200
id = request.params['id']
+ captcha_hidden_field_id = simple_captch_hidden_field_id(id)
body = %Q{
$("##{id}").attr('src', '#{url}');
- $("#captcha_key").attr('value', '#{key}');
+ $("##{ captcha_hidden_field_id }").attr('value', '#{key}');
}
- headers = {'Content-Type' => 'text/javascript; charset=utf-8', "Content-Disposition" => "inline; filename='captcha.js'", "Content-Length" => body.length.to_s}
+ headers = {'Content-Type' => 'text/javascript; charset=utf-8', "Content-Disposition" => "inline; filename='captcha.js'", "Content-Length" => body.length.to_s}.merge(SimpleCaptcha.extra_response_headers)
[status, headers, [body]]
end
end
end