Class: Unidom::Visitor::User

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Common::Concerns::ModelExtension
Defined in:
app/models/unidom/visitor/user.rb

Overview

User 是系统用户。

Class Method Summary collapse

Class Method Details

.sign_up(identity, password) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/models/unidom/visitor/user.rb', line 18

def self.(identity, password)

  return false if identified_by(identity).valid_at.alive.merge(::Unidom::Visitor::Identificating.valid_at.alive).count>0

  now        = Time.now
  user       = self.create! opened_at: now
  credential = ::Unidom::Visitor::Password.create! clear_text: password, opened_at: now

  identificating = ::Unidom::Visitor::Identificating.identificate user, identity
  authenticating = ::Unidom::Visitor::Authenticating.authenticate user, credential

  user

end