class Omnipass::Email

Public Class Methods

authenticate(params) click to toggle source
# File lib/omnipass/email.rb, line 20
def self.authenticate(params)
  login_pass_hash = params.symbolize_keys

  instance = locate(login_pass_hash.slice(:email))
  return false unless instance
  instance.authenticate(login_pass_hash[:password])
end
find_by_token(token) click to toggle source
# File lib/omnipass/email.rb, line 14
def self.find_by_token(token)
  unless token.blank?
    all.where(confirmation_token: token).first
  end
end
locate(search_hash) click to toggle source
# File lib/omnipass/email.rb, line 28
def self.locate(search_hash)
  where(search_hash).first
end

Public Instance Methods

confirm() click to toggle source
# File lib/omnipass/email.rb, line 42
def confirm
  generate_confirmation_token
  self.confirmed_at= Time.now.utc
  save
end
confirmed?() click to toggle source
# File lib/omnipass/email.rb, line 48
def confirmed?
  !!confirmed_at
end
form_admin(params = nil) click to toggle source
# File lib/omnipass/email.rb, line 52
def form_admin(params = nil)
  Admin::Users::IdentityForm.new(params, self)
end
generate_confirmation_token() click to toggle source
# File lib/omnipass/email.rb, line 38
def generate_confirmation_token
  self.confirmation_token = SecureRandom.base58(24)
end
info() click to toggle source
# File lib/omnipass/email.rb, line 34
def info
  {name: email, email: email}
end