class Digestive::User

A simple User class which will function with Digestive.

Constants

DIGEST_REALM

The realm to which the user will authenticate

Public Instance Methods

as_json(options={}) click to toggle source

The JSON representation of a User conceals the password

Calls superclass method
# File lib/digestive/user.rb, line 21
def as_json(options={})
  hash = super(options)
  hash['user']['password'] = ''
  hash
end

Private Instance Methods

digest_encrypt_password() click to toggle source

User’s password is encrypted before save

# File lib/digestive/user.rb, line 30
def digest_encrypt_password
  if password_changed? || username_changed?
    self.password = encrypt_password(username, DIGEST_REALM, password)
  end
end