Permalink
Browse files

Fixed issue with timestamp

  • Loading branch information...
1 parent 4d4827b commit 76713fd519c4511f4b0cae417979545ba40719ee @stefants stefants committed May 24, 2011
Showing with 2 additions and 2 deletions.
  1. +1 −1 lib/negative_captcha.rb
  2. +1 −1 lib/negative_captcha_view_helpers.rb
View
2 lib/negative_captcha.rb
@@ -17,7 +17,7 @@ class NegativeCaptcha
def initialize(opts)
@secret = opts[:secret]||(RUBY_19 ? Digest::MD5.hexdigest("this_is_a_secret_key") : MD5.hexdigest("this_is_a_secret_key"))
- @timestamp = (opts.has_key?(:params) ? opts[:params][:timestamp] : nil) || Time.now()
+ @timestamp = (opts.has_key?(:params) ? opts[:params][:timestamp] : nil) || Time.now.to_i
spinner_text = ([@timestamp, @secret] + (opts[:spinner].is_a?(Array) ? opts[:spinner] : [opts[:spinner]]))*'-'
@spinner = RUBY_19 ? Digest::MD5.hexdigest(spinner_text) : MD5.hexdigest(spinner_text)
@message = opts[:message]||"Please try again. This usually happens because an automated script attempted to submit this form."
View
2 lib/negative_captcha_view_helpers.rb
@@ -1,7 +1,7 @@
module NegativeCaptchaViewHelpers
def negative_captcha(captcha)
[
- hidden_field_tag('timestamp', captcha.timestamp.to_i),
+ hidden_field_tag('timestamp', captcha.timestamp),
hidden_field_tag('spinner', captcha.spinner),
].join
end

0 comments on commit 76713fd

Please sign in to comment.