Module: HyperKittenMeow::Concerns::Models::User
- Extended by:
- ActiveSupport::Concern
- Included in:
- User
- Defined in:
- lib/hyper_kitten_meow/concerns/models/user.rb
Constant Summary collapse
- VALID_EMAIL_REGEX =
/\A[\w+\-.]+@[a-z\d\-]+(\.[a-z\d\-]+)*\.[a-z]+\z/i
Instance Method Summary collapse
-
#authenticated?(remember_token) ⇒ Boolean
Returns true if the given token matches the digest.
-
#set_encrypted_remember_token! ⇒ Object
Remembers a user in the database for use in persistent sessions.
Instance Method Details
#authenticated?(remember_token) ⇒ Boolean
Returns true if the given token matches the digest.
25 26 27 |
# File 'lib/hyper_kitten_meow/concerns/models/user.rb', line 25 def authenticated?(remember_token) BCrypt::Password.new(remember_digest).is_password?(remember_token) end |
#set_encrypted_remember_token! ⇒ Object
Remembers a user in the database for use in persistent sessions.
30 31 32 33 |
# File 'lib/hyper_kitten_meow/concerns/models/user.rb', line 30 def set_encrypted_remember_token! self.remember_token = generate_new_token update_attribute(:remember_digest, Encryptor.encrypt(remember_token)) end |