Module: DataMapper::Is::Authenticatable::InstanceMethods
- Defined in:
- lib/dm-is-authenticatable/is/authenticatable.rb
Overview
Instance methods.
Instance Attribute Summary collapse
-
#password ⇒ Object
The clear-text password.
-
#password_confirmation ⇒ Object
The confirmed clear-text password.
Instance Method Summary collapse
-
#has_password?(submitted_password) ⇒ Boolean
Determines if the submitted password matches the
encrypted_password
. -
#password_required? ⇒ Boolean
Determines if a password is required for authentication.
Instance Attribute Details
#password ⇒ Object
The clear-text password
53 54 55 |
# File 'lib/dm-is-authenticatable/is/authenticatable.rb', line 53 def password @password end |
#password_confirmation ⇒ Object
The confirmed clear-text password
56 57 58 |
# File 'lib/dm-is-authenticatable/is/authenticatable.rb', line 56 def password_confirmation @password_confirmation end |
Instance Method Details
#has_password?(submitted_password) ⇒ Boolean
Determines if the submitted password matches the encrypted_password
.
95 96 97 98 99 100 101 |
# File 'lib/dm-is-authenticatable/is/authenticatable.rb', line 95 def has_password?(submitted_password) if password_required? self.encrypted_password == submitted_password else submitted_password.nil? || submitted_password.empty? end end |
#password_required? ⇒ Boolean
Determines if a password is required for authentication.
80 81 82 |
# File 'lib/dm-is-authenticatable/is/authenticatable.rb', line 80 def password_required? !self.encrypted_password.nil? end |