Class: Admin::User

Inherits:
ApplicationRecord show all
Includes:
Koi::Model::Archivable, Koi::Model::OTP, PgSearch::Model
Defined in:
app/models/admin/user.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Koi::Model::OTP

#otp, #requires_otp?

Methods included from Koi::Model::Archivable

#archive, #archive!, #archived=, #archived?, #restore, #restore!

Class Method Details

.model_nameObject



8
9
10
# File 'app/models/admin/user.rb', line 8

def self.model_name
  ActiveModel::Name.new(self, nil, "AdminUser")
end

Instance Method Details

#passkey?Boolean Also known as: passkey

Returns:

  • (Boolean)


67
68
69
# File 'app/models/admin/user.rb', line 67

def passkey?
  credentials.any?
end

#password_loginObject



72
73
74
75
76
77
78
79
80
# File 'app/models/admin/user.rb', line 72

def 
  if password_digest.blank?
    :none
  elsif otp_secret.nil?
    :password_only
  else
    :mfa
  end
end

#to_sObject



82
83
84
# File 'app/models/admin/user.rb', line 82

def to_s
  name
end