Class: User

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/user.rb

Instance Method Summary collapse

Instance Method Details

#valid_token?(client_id, token) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
13
14
# File 'app/models/user.rb', line 9

def valid_token?(client_id, token)
  return false unless self.tokens[client_id]['expiry'] > 2.weeks.ago
  return false unless BCrypt::Password.new(self.tokens[client_id]['token']) == token

  return true
end