Comparison

mod_audit_register/mod_audit_register.lua @ 4932:530d116b7f68

mod_audit*: modules for audit logging in prosody These are to be seen as proof-of-concept for now.
author Jonas Schäfer <jonas@wielicki.name>
date Tue, 26 Apr 2022 22:32:44 +0200
child 4933:08dea42a302a
comparison
equal deleted inserted replaced
4931:f4a9e804c457 4932:530d116b7f68
1 module:depends("audit");
2
3 local st = require "util.stanza";
4
5 module:hook("user-registered", function(event)
6 local session = event.session;
7 local custom = {};
8 local invite = event.validated_invite or (event.session and event.session.validated_invite);
9 if invite then
10 table.insert(custom, st.stanza(
11 "invite-used",
12 {
13 xmlns = "xmpp:prosody.im/audit",
14 token = invite.token,
15 }
16 ))
17 end
18 module:audit(event.username, "user-registered", {
19 session = session,
20 custom = custom,
21 });
22 end);