Mercurial > prosody-modules
annotate mod_invites_tracking/mod_invites_tracking.lua @ 6319:04c3273cb81f
mod_auth_cyrus: Add empty 'profile' table to SASL handler objects
This is for compatibility with Prosody's built-in util.sasl objects.
A SASL profile table usually includes methods supported by the backend, which
can be used by SASL mechanism handlers to perform operations (such as testing
the password). It also optionally contains a 'cb' field with channel binding
method handlers.
The Cyrus backend doesn't support channel binding, and doesn't have the same
concept of auth backend methods (it handles all that internally, and Prosody
has no insight or control over it).
Thus, we create an empty profile which informs Prosody that the SASL handler
does not support any of the auth or channel binding methods. Some features
will not work, but they didn't work anyway. This just makes it explicit.
This fixes a traceback in mod_sasl2_fast, which expected SASL handlers to
always contain a 'profile' field.
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 04 Sep 2025 10:14:46 +0100 |
| parents | 9ed02a4f6ff4 |
| children |
| rev | line source |
|---|---|
|
4394
32f1f18f4874
mod_invites_tracking: simple module to store who created an invite
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
1 local tracking_store = module:open_store("invites_tracking"); |
|
32f1f18f4874
mod_invites_tracking: simple module to store who created an invite
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
2 |
|
32f1f18f4874
mod_invites_tracking: simple module to store who created an invite
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
3 module:hook("user-registered", function(event) |
|
32f1f18f4874
mod_invites_tracking: simple module to store who created an invite
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
4 local validated_invite = event.validated_invite or (event.session and event.session.validated_invite); |
|
32f1f18f4874
mod_invites_tracking: simple module to store who created an invite
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
5 local new_username = event.username; |
|
32f1f18f4874
mod_invites_tracking: simple module to store who created an invite
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
6 |
|
5901
9ed02a4f6ff4
mod_invites_tracking: Don't bother storing anything for non-invite IBR
Matthew Wild <mwild1@gmail.com>
parents:
5900
diff
changeset
|
7 if not validated_invite then |
|
9ed02a4f6ff4
mod_invites_tracking: Don't bother storing anything for non-invite IBR
Matthew Wild <mwild1@gmail.com>
parents:
5900
diff
changeset
|
8 module:log("debug", "No invitation found for registration of %s", new_username); |
|
9ed02a4f6ff4
mod_invites_tracking: Don't bother storing anything for non-invite IBR
Matthew Wild <mwild1@gmail.com>
parents:
5900
diff
changeset
|
9 return; |
|
9ed02a4f6ff4
mod_invites_tracking: Don't bother storing anything for non-invite IBR
Matthew Wild <mwild1@gmail.com>
parents:
5900
diff
changeset
|
10 end |
|
9ed02a4f6ff4
mod_invites_tracking: Don't bother storing anything for non-invite IBR
Matthew Wild <mwild1@gmail.com>
parents:
5900
diff
changeset
|
11 |
|
4394
32f1f18f4874
mod_invites_tracking: simple module to store who created an invite
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
12 local invite_id = nil; |
|
32f1f18f4874
mod_invites_tracking: simple module to store who created an invite
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
13 local invite_source = nil; |
|
32f1f18f4874
mod_invites_tracking: simple module to store who created an invite
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
14 if validated_invite then |
|
32f1f18f4874
mod_invites_tracking: simple module to store who created an invite
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
15 invite_source = validated_invite.additional_data and validated_invite.additional_data.source; |
|
32f1f18f4874
mod_invites_tracking: simple module to store who created an invite
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
16 invite_id = validated_invite.token; |
|
32f1f18f4874
mod_invites_tracking: simple module to store who created an invite
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
17 end |
|
32f1f18f4874
mod_invites_tracking: simple module to store who created an invite
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
18 |
|
5900
cb3b2fbf57e7
mod_invites_tracking: Fix traceback when not registering via invite (thanks Link Mauve)
Matthew Wild <mwild1@gmail.com>
parents:
4394
diff
changeset
|
19 tracking_store:set(new_username, {invite_id = invite_id, invite_source = invite_source}); |
|
4394
32f1f18f4874
mod_invites_tracking: simple module to store who created an invite
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
20 module:log("debug", "recorded that invite from %s was used to create %s", invite_source, new_username) |
|
32f1f18f4874
mod_invites_tracking: simple module to store who created an invite
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
21 end); |
|
32f1f18f4874
mod_invites_tracking: simple module to store who created an invite
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
22 |
|
32f1f18f4874
mod_invites_tracking: simple module to store who created an invite
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
23 -- " " is an invalid localpart -> we can safely use it for store metadata |
|
32f1f18f4874
mod_invites_tracking: simple module to store who created an invite
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
24 tracking_store:set(" ", {version="1"}); |
