X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/0d3a9ed9cb47ce3b89ea9eaffbb589f9a9ff6d22..821a22c6073d4b50ae7038e9c1aacbb5e68cd55a:/app/models/oauth_token.rb?ds=inline diff --git a/app/models/oauth_token.rb b/app/models/oauth_token.rb index c9595e870..0fe0bea30 100644 --- a/app/models/oauth_token.rb +++ b/app/models/oauth_token.rb @@ -2,7 +2,7 @@ class OauthToken < ActiveRecord::Base belongs_to :client_application belongs_to :user - scope :authorized, where("authorized_at IS NOT NULL and invalidated_at IS NULL") + scope :authorized, -> { where("authorized_at IS NOT NULL and invalidated_at IS NULL") } validates_uniqueness_of :token validates_presence_of :client_application, :token @@ -14,9 +14,7 @@ class OauthToken < ActiveRecord::Base end def invalidate! - update_attributes({ - :invalidated_at => Time.now - }, :without_protection => true) + update_attributes(:invalidated_at => Time.now) end def authorized?