Module: Sequel::Plugins::Password::InstanceMethods
- Defined in:
- lib/sequel_password.rb
Instance Method Summary collapse
- #[]=(attr, plain) ⇒ Object
-
#authenticate(password) ⇒ Boolean
Check if given password match the existing one.
-
#set_unusable_password ⇒ Object
Sets the password as unusable.
Instance Method Details
#[]=(attr, plain) ⇒ Object
96 97 98 99 |
# File 'lib/sequel_password.rb', line 96 def []=(attr, plain) value = model.make_password(plain) if attr == model.column super(attr, value || plain) end |
#authenticate(password) ⇒ Boolean
Check if given password match the existing one.
91 92 93 94 |
# File 'lib/sequel_password.rb', line 91 def authenticate(password) encoded = send(model.column) model.check_password(password, encoded, setter: method(:"#{model.column}=")) end |
#set_unusable_password ⇒ Object
Sets the password as unusable.
102 103 104 |
# File 'lib/sequel_password.rb', line 102 def set_unusable_password send("#{model.column}=", nil) end |