]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/oauth_nonce.rb
Localisation updates from https://translatewiki.net.
[rails.git] / app / models / oauth_nonce.rb
index 4d615dd5defcba96a238bf6cfbab81d55ff6b875..e0510dcbf85bb59a237b33fca0c8aa6a9008ece2 100644 (file)
@@ -6,7 +6,8 @@ class OauthNonce < ActiveRecord::Base
 
   # Remembers a nonce and it's associated timestamp. It returns false if it has already been used
   def self.remember(nonce, timestamp)
-    oauth_nonce = OauthNonce.create(:nonce => nonce, :timestamp => timestamp)
+    return false if Time.now.to_i - timestamp.to_i > 86400
+    oauth_nonce = OauthNonce.create(:nonce => nonce, :timestamp => timestamp.to_i)
     return false if oauth_nonce.new_record?
     oauth_nonce
   end