app/models/unidom/visitor/authenticating.rb in unidom-visitor-1.12.3 vs app/models/unidom/visitor/authenticating.rb in unidom-visitor-1.12.4
- old
+ new
@@ -17,12 +17,15 @@
scope :credential_is, ->(credential) { where credential: credential }
scope :visitor_type_is, ->(visitor_type) { where visitor_type: visitor_type }
scope :credential_type_is, ->(credential_type) { where credential_type: credential_type }
+ ##
+ # 将访问者 visitor 和信任状 credential 关联起来。关联时间是 opened_at ,缺省是当前时间。如:
+ # Unidom::Visitor::Authenticating.authenticate! user, with: password
def self.authenticate!(visitor, with: nil, opened_at: Time.now)
credential_is(with).visitor_is(visitor).valid_at.alive.first_or_create! opened_at: opened_at
end
code :flag, Unidom::Visitor::Flag
-end
+end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::Visitor::Authenticating'