comparison plugins/mod_account_activity.lua @ 14047:f463e101fbd9 13.0 13.0.4

mod_account_activity: Handle authentication provider returning no user info
author Matthew Wild <mwild1@gmail.com>
date Tue, 20 Jan 2026 11:04:41 +0000
parents 0055c177a54c
children 04c3687b5641 0c81b8fede94
comparison
equal deleted inserted replaced
14046:e9aa551f3f8f 14047:f463e101fbd9
67 local n_inactive, n_unknown = 0, 0; 67 local n_inactive, n_unknown = 0, 0;
68 68
69 for username in um.users(host) do 69 for username in um.users(host) do
70 local last_active = store:get_key(username, "timestamp"); 70 local last_active = store:get_key(username, "timestamp");
71 if not last_active then 71 if not last_active then
72 local created_at = um.get_account_info(username, host).created; 72 local user_info = um.get_account_info(username, host);
73 if created_at and (now - created_at) > duration_sec then 73 local created_at;
74 self.session.print(username, ""); 74 if user_info then
75 n_inactive = n_inactive + 1; 75 created_at = user_info.created;
76 elseif not created_at then 76 if created_at and (now - created_at) > duration_sec then
77 self.session.print(username, "");
78 n_inactive = n_inactive + 1;
79 end
80 end
81 if not created_at then
77 n_unknown = n_unknown + 1; 82 n_unknown = n_unknown + 1;
78 end 83 end
79 elseif (now - last_active) > duration_sec then 84 elseif (now - last_active) > duration_sec then
80 self.session.print(username, os.date("%Y-%m-%dT%T", last_active)); 85 self.session.print(username, os.date("%Y-%m-%dT%T", last_active));
81 n_inactive = n_inactive + 1; 86 n_inactive = n_inactive + 1;