Sha256: afdfceef9bb64e13a9086bd3a17223817fc1e2ec742e046ad8f3b45570078af7
Contents?: true
Size: 770 Bytes
Versions: 6
Compression:
Stored size: 770 Bytes
Contents
class Devise::Oauth2Providable::Client < ActiveRecord::Base has_many :access_tokens has_many :refresh_tokens has_many :authorization_codes before_validation :init_identifier, :on => :create, :unless => :identifier? before_validation :init_secret, :on => :create, :unless => :secret? validates :website, :secret, :presence => true validates :name, :presence => true, :uniqueness => true validates :identifier, :presence => true, :uniqueness => true def expire_tokens_for_user(user) access_tokens.unexpired.user_id(user.id).update_all(expires_at: Time.zone.now) end private def init_identifier self.identifier = Devise::Oauth2Providable.random_id end def init_secret self.secret = Devise::Oauth2Providable.random_id end end
Version data entries
6 entries across 6 versions & 1 rubygems