Skip to content

Commit

Permalink
Resolving conflict in bartt's commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason L Perry committed Jan 1, 2009
1 parent 48de1f5 commit 782bf02
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lib/recaptcha.rb
Expand Up @@ -7,7 +7,7 @@ module ReCaptcha

SKIP_VERIFY_ENV = ['test']

module Helper
module Helper
# Your public API can be specified in the +options+ hash or preferably the environment
# variable +RECAPTCHA_PUBLIC_KEY+.
def recaptcha_tags(options = {})
Expand All @@ -16,7 +16,7 @@ def recaptcha_tags(options = {})
error = options[:error] ||= session[:recaptcha_error]
uri = options[:ssl] ? RECAPTCHA_API_SECURE_SERVER : RECAPTCHA_API_SERVER
xhtml = Builder::XmlMarkup.new :target => out=(''), :indent => 2 # Because I can.
if options[:display]
if options[:display]
xhtml.script(:type => "text/javascript"){ |x| x << "var RecaptchaOptions = #{options[:display].to_json};\n"}
end
if options[:ajax]
Expand All @@ -29,11 +29,13 @@ def recaptcha_tags(options = {})
xhtml.script(:type => "text/javascript", :src => :"#{uri}/challenge?k=#{key}&error=#{error}") {}
unless options[:noscript] == false
xhtml.noscript do
xhtml.iframe(:src => "#{uri}/noscript?k=#{key}",
xhtml.iframe(:src => "#{uri}/noscript?k=#{key}",
:height => options[:iframe_height] ||= 300,
:width => options[:iframe_width] ||= 500,
:frameborder => 0) {}; xhtml.br
xhtml.textarea(nil, :name => "recaptcha_challenge_field", :rows => 3, :cols => 40)
xhtml.textarea nil, :name => "recaptcha_challenge_field",
:rows => options[:textarea_rows] ||= 3,
:cols => options[:textarea_cols] ||= 40
xhtml.input :name => "recaptcha_response_field",
:type => "hidden", :value => "manual_challenge"
end
Expand All @@ -43,7 +45,7 @@ def recaptcha_tags(options = {})
return out
end # recaptcha_tags
end # Helpers

module Controller
# Your private API can be specified in the +options+ hash or preferably the environment
# variable +RECAPTCHA_PUBLIC_KEY+.
Expand Down Expand Up @@ -72,11 +74,11 @@ def verify_recaptcha(options = {})
end
rescue Exception => e
raise ReCaptchaError, e
end
end
end # verify_recaptcha
end # ControllerHelpers

class ReCaptchaError < StandardError; end

end # ReCaptcha
end # Ambethia

0 comments on commit 782bf02

Please sign in to comment.