Class: Relay::Models::User
- Inherits:
-
Sequel::Model
- Object
- Sequel::Model
- Relay::Models::User
- Includes:
- Relay::Model
- Defined in:
- app/models/user.rb
Instance Method Summary collapse
-
#authenticate(value) ⇒ Relay::Models::User, false
Authenticates the given plaintext password.
-
#password=(value) ⇒ Object
Hashes and stores the given password.
Methods included from Relay::Model
Instance Method Details
#authenticate(value) ⇒ Relay::Models::User, false
Authenticates the given plaintext password.
23 24 25 26 27 28 29 |
# File 'app/models/user.rb', line 23 def authenticate(value) return false if password_digest.to_s.empty? BCrypt::Password.new(password_digest) == value && self rescue BCrypt::Errors::InvalidHash false end |
#password=(value) ⇒ Object
Hashes and stores the given password.
14 15 16 17 |
# File 'app/models/user.rb', line 14 def password=(value) @password = value self.password_digest = BCrypt::Password.create(value) end |