X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/f1c6a87aa137c11d0aff5a4b0e563ac2c2a8f82d..7e5cbe87ed37f9cba8224fa4049047d7f981f66a:/app/models/oauth_token.rb diff --git a/app/models/oauth_token.rb b/app/models/oauth_token.rb index affdcdeb8..ae15dc658 100644 --- a/app/models/oauth_token.rb +++ b/app/models/oauth_token.rb @@ -36,8 +36,8 @@ # class OauthToken < ApplicationRecord - belongs_to :client_application - belongs_to :user + belongs_to :client_application, :optional => true + belongs_to :user, :optional => true scope :authorized, -> { where("authorized_at IS NOT NULL and invalidated_at IS NULL") } @@ -52,7 +52,7 @@ class OauthToken < ApplicationRecord end def invalidate! - update(:invalidated_at => Time.now) + update(:invalidated_at => Time.now.utc) end def authorized?