File tree Expand file tree Collapse file tree
lib/ontologies_linked_data/models/users Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ class User < LinkedData::Models::Base
2828 attribute :githubId , enforce : [ :unique ]
2929 attribute :orcidId , enforce : [ :unique ]
3030 attribute :created , enforce : [ :date_time ] , :default => lambda { |record | DateTime . now }
31+ attribute :lastLoginAt , enforce : [ :date_time ] , :default => lambda { |record | DateTime . now }
3132 attribute :passwordHash , enforce : [ :existence ]
3233 attribute :apikey , enforce : [ :unique ] , :default => lambda { |x | SecureRandom . uuid }
3334 attribute :subscription , enforce : [ :list , :subscription ]
@@ -81,6 +82,11 @@ def initialize(attributes = {})
8182 self
8283 end
8384
85+ def update_last_login
86+ self . lastLoginAt = DateTime . now
87+ self . save
88+ end
89+
8490 def save ( *args )
8591 # Reset ontology cache if user changes their custom set
8692 if LinkedData . settings . enable_http_cache && self . modified_attributes . include? ( :customOntology )
You can’t perform that action at this time.
0 commit comments