Commits

Daniel Poelzleithner committed ccdf197

add support for considering long not used accounts as broken

Comments (0)

Files changed (3)

app/main/index/_action/login.lua

 
 if member then
   app.session.member = member
+  db:query{ "UPDATE member SET last_login = now() WHERE id = ?", member.id }
   app.session:save()
   slot.select("notice", function()
     ui.tag{ content = _'Login successful!' }

app/main/member/show_tab.lua

 
   local broken_delegations = Delegation:new_selector()
     :join("member", nil, "delegation.trustee_id = member.id")
-    :add_where{"member.active = 'f' AND delegation.truster_id = ?", member.id}
+    :add_where{"delegation.truster_id = ?", member.id}
+    if config.delegation_warning_time then
+      broken_delegations:add_where{"member.active = 'f' OR (member.last_login IS NULL OR age(member.last_login) > ?::interval)", config.delegation_warning_time}
+    else
+      broken_delegations:add_where{"member.active = 'f'"}
+    end
 
   if broken_delegations:count() then
     tabs[#tabs+1] = {

config/default.lua

 
 config.auto_support = true
 
+-- after how long is a user considered inactive and the trustee will see warning
+config.delegation_warning_time = '6 weeks'
+
 config.mail_subject_prefix = "[LiquidFeedback] "
 
 config.fastpath_url_func = nil