Class: User

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

Instance Method Summary collapse

Instance Method Details

#email_changed?Boolean

don’t use default devise email validation

Returns:

  • (Boolean)


28
29
30
# File 'app/models/user.rb', line 28

def email_changed?
  false
end

#serializable_hash(options = {}) ⇒ Object



21
22
23
24
25
# File 'app/models/user.rb', line 21

def serializable_hash(options={})
  options ||= {}
  options[:except] ||= [:tokens]
  super(options)
end

#valid_token?(client_id, token) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
18
19
# File 'app/models/user.rb', line 14

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