X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/2d22ab10f759828e27876f138b419ff4c0913b87..dbe165bbb3d6eda37d9579f1ac767599f9055607:/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