X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/037585db3933a2954b43bd4b30ea5e30ade00be2..a402e811dac1f999dcf623ce6099e554d76c6de4:/app/models/oauth_nonce.rb diff --git a/app/models/oauth_nonce.rb b/app/models/oauth_nonce.rb index 4d615dd5d..e0510dcbf 100644 --- a/app/models/oauth_nonce.rb +++ b/app/models/oauth_nonce.rb @@ -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