Sha256: 9e2011a3f0bc4fb018723c3dcab7826af35ebd650813a780f3ee8daf009ddd4e
Contents?: true
Size: 926 Bytes
Versions: 1
Compression:
Stored size: 926 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.where(user_id: user.id).where('expires_at > ?', Time.zone.now).update_all(expires_at: Time.zone.now) refresh_tokens.where(user_id: user.id).where('expires_at > ?', Time.zone.now).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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
brycesch-devise_oauth2_providable-1.2.8 | app/models/devise/oauth2_providable/client.rb |