X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/ef7f3d800cbdd49b692df10d312e5fd880e2e938..0d01d06f224c7c7606d39862150d132c3fe2590b:/app/models/oauth_token.rb diff --git a/app/models/oauth_token.rb b/app/models/oauth_token.rb index f2dd31df0..9a3e7de9e 100644 --- a/app/models/oauth_token.rb +++ b/app/models/oauth_token.rb @@ -4,8 +4,9 @@ class OauthToken < ActiveRecord::Base scope :authorized, -> { where("authorized_at IS NOT NULL and invalidated_at IS NULL") } - validates_uniqueness_of :token - validates_presence_of :client_application, :token + validates :token, :presence => true, :uniqueness => true + validates :user, :associated => true + validates :client_application, :presence => true before_validation :generate_keys, :on => :create