Module: Panmind::Recaptcha::Helpers
- Defined in:
- lib/panmind/recaptcha.rb
Overview
Controller
Instance Method Summary collapse
Instance Method Details
#recaptcha(options = {}) ⇒ Object
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/panmind/recaptcha.rb', line 97 def recaptcha( = {}) return unless Recaptcha.enabled? if Recaptcha.private_key.blank? || Recaptcha.public_key.blank? raise ConfigurationError, 'ReCaptcha keys are missing' end label_text = .delete(:label) || 'Enter the following words' = {:width => 420, :height => 320}.merge( .delete(:noscript) || {}) = .empty? ? '' : javascript_tag(%[var RecaptchaOptions = #{.to_json}]) label_tag('recaptcha_response_field', label_text) + + %[<script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge?k=#{Recaptcha.public_key}"> </script> <noscript> <iframe src="http://www.google.com/recaptcha/api/noscript?k=#{Recaptcha.public_key}" height="#{[:width]}" width="#{[:height]}" frameborder="0"></iframe><br> <input type="text" class="text" name="recaptcha_challenge_field" tabindex="#{[:tabindex]}"/> <input type="hidden" name="recaptcha_response_field" value="manual_challenge" /> </noscript> ].html_safe end |