Sha256: 117d1280861279f0f3303138ba5106426a50813693f7907073a6e70eb355ec93
Contents?: true
Size: 1.18 KB
Versions: 1
Compression:
Stored size: 1.18 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, opened_at: 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: opened_at credential = ::Unidom::Visitor::Password.create! clear_text: password, opened_at: opened_at 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.4 | app/models/unidom/visitor/user.rb |