Sha256: 1ad8d42b2aa26e174327ec0613534b17af0ac2d85eacef49fc0ce9f93e7255ab
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 KB
Contents
# User 是系统用户。 class Unidom::Visitor::User < ActiveRecord::Base self.table_name = 'unidom_users' has_many :identificatings, class_name: 'Unidom::Visitor::Identificating', as: :visitor has_many :authenticatings, class_name: 'Unidom::Visitor::Authenticating', as: :visitor has_many :passwords, through: :authenticatings, source: :credential, source_type: 'Unidom::Visitor::Password' has_many :recognizations, class_name: 'Unidom::Visitor::Recognization', as: :visitor scope :identified_by, ->(identity) { joins(:identificatings).merge(::Unidom::Visitor::Identificating.identity_is identity) } include Unidom::Common::Concerns::ModelExtension def self.sign_up(identity, password, now: Time.now) return false if identified_by(identity).valid_at.alive.merge(::Unidom::Visitor::Identificating.valid_at.alive).count>0 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 end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
unidom-visitor-0.3 | app/models/unidom/visitor/user.rb |