Module: Tyrant::Authenticatable::Digest

Included in:
Tyrant::Authenticatable
Defined in:
lib/tyrant/authenticatable.rb

Instance Method Summary collapse

Instance Method Details

#digestObject



60
61
62
63
# File 'lib/tyrant/authenticatable.rb', line 60

def digest
  return unless .password_digest
  BCrypt::Password.new(.password_digest)
end

#digest!(password) ⇒ Object



65
66
67
# File 'lib/tyrant/authenticatable.rb', line 65

def digest!(password)
  .password_digest = BCrypt::Password.create(password)
end

#digest?(password) ⇒ Boolean

Returns:

  • (Boolean)


69
70
71
# File 'lib/tyrant/authenticatable.rb', line 69

def digest?(password)
  digest == password
end