Module: MinimalistAuthentication::User
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/minimalist_authentication/user.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#authenticated?(password) ⇒ Boolean
Returns true if password matches the hashed_password, otherwise returns false.
-
#enabled ⇒ Object
Called after a user is authenticated to determine if the user object should be returned.
-
#enabled? ⇒ Boolean
Returns true if the user is enabled.
-
#errors ⇒ Object
Remove the has_secure_password password blank error when password is not required.
-
#guest? ⇒ Boolean
Deprecated method to check if the user is a guest.
-
#inactive? ⇒ Boolean
Returns true if the user is not active.
-
#logged_in ⇒ Object
Sets #last_logged_in_at to the current time without updating the updated_at timestamp.
-
#verified_update ⇒ Object
Overridden by EmailVerification to verify email upon update.
Instance Method Details
#authenticated?(password) ⇒ Boolean
Returns true if password matches the hashed_password, otherwise returns false.
91 92 93 94 95 96 |
# File 'lib/minimalist_authentication/user.rb', line 91 def authenticated?(password) MinimalistAuthentication.deprecator.warn(" Calling #authenticated? is deprecated. Use #authenticate instead.\n MSG\n authenticate(password)\nend\n".squish) |
#enabled ⇒ Object
Called after a user is authenticated to determine if the user object should be returned.
75 76 77 |
# File 'lib/minimalist_authentication/user.rb', line 75 def enabled self if enabled? end |
#enabled? ⇒ Boolean
Returns true if the user is enabled. Override this method in your user model to implement custom logic that determines if a user is eligible to log in.
81 82 83 |
# File 'lib/minimalist_authentication/user.rb', line 81 def enabled? active? end |
#errors ⇒ Object
Remove the has_secure_password password blank error when password is not required.
86 87 88 |
# File 'lib/minimalist_authentication/user.rb', line 86 def errors super.tap { |errors| errors.delete(:password, :blank) unless password_required? } end |
#guest? ⇒ Boolean
Deprecated method to check if the user is a guest. Returns false because the guest user has been removed.
99 100 101 102 103 104 105 106 |
# File 'lib/minimalist_authentication/user.rb', line 99 def guest? MinimalistAuthentication.deprecator.warn(" Calling #guest? is deprecated. Use #MinimalistAuthentication::Controller#logged_in? to\n check for the presence of a current_user instead.\n MSG\n\n false\nend\n".squish) |
#inactive? ⇒ Boolean
Returns true if the user is not active.
109 110 111 |
# File 'lib/minimalist_authentication/user.rb', line 109 def inactive? !active? end |
#logged_in ⇒ Object
Sets #last_logged_in_at to the current time without updating the updated_at timestamp.
114 115 116 |
# File 'lib/minimalist_authentication/user.rb', line 114 def logged_in update_column(:last_logged_in_at, Time.current) end |
#verified_update ⇒ Object
Overridden by EmailVerification to verify email upon update.
119 120 121 |
# File 'lib/minimalist_authentication/user.rb', line 119 def verified_update(*) update(*) end |