Module: MinimalistAuthentication::User::ClassMethods

Defined in:
lib/minimalist_authentication/user.rb

Instance Method Summary collapse

Instance Method Details

#find_enabled(id) ⇒ Object

Finds a user by their id and returns the user if they are enabled. Returns nil if the user is not found or not enabled.



44
45
46
# File 'lib/minimalist_authentication/user.rb', line 44

def find_enabled(id)
  find_by(id:)&.enabled if id.present?
end

#inactiveObject



48
49
50
51
52
53
# File 'lib/minimalist_authentication/user.rb', line 48

def inactive
  MinimalistAuthentication.deprecator.warn(<<-MSG.squish)
    Calling #inactive is deprecated. Use #active(false) instead.
  MSG
  active(false)
end

#password_minimumObject

Minimum password length



56
# File 'lib/minimalist_authentication/user.rb', line 56

def password_minimum = 12