Class: Maquina::User

Inherits:
ApplicationRecord show all
Includes:
AuthenticateBy, Blockeable, Multifactor, RetainPasswords
Defined in:
app/models/maquina/user.rb

Constant Summary collapse

PASSWORD_COMPLEXITY_REGEX =
/\A(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&#-=+])[A-Za-z\d@$!%*?&#-=+]{8,}\z/

Instance Method Summary collapse

Methods inherited from ApplicationRecord

searchable?

Instance Method Details

#default_membershipObject



27
28
29
30
31
# File 'app/models/maquina/user.rb', line 27

def default_membership
  return nil if management?

  memberships.detect { |membership| membership.blocked_at.blank? && membership.organization.present? && membership.organization.active? }
end

#expired_password?Boolean

Returns:

  • (Boolean)


21
22
23
24
25
# File 'app/models/maquina/user.rb', line 21

def expired_password?
  return false if password_expires_at.blank?

  password_expires_at < Time.zone.now
end