Software / code / prosody
Comparison
plugins/mod_invites_register.lua @ 13844:bb15cbb856a1
Merge 13.0->trunk
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 10 Apr 2025 16:07:54 +0100 |
| parent | 13843:87dd8639f08f |
| child | 13849:068e77bf91b9 |
comparison
equal
deleted
inserted
replaced
| 13842:31fa834108bc | 13844:bb15cbb856a1 |
|---|---|
| 99 -- This registration is not using an invite, but | 99 -- This registration is not using an invite, but |
| 100 -- the server is not in invite-only mode, so nothing | 100 -- the server is not in invite-only mode, so nothing |
| 101 -- for this module to do... | 101 -- for this module to do... |
| 102 return; | 102 return; |
| 103 end | 103 end |
| 104 if validated_invite and validated_invite.additional_data and validated_invite.additional_data.allow_reset then | 104 if validated_invite then |
| 105 event.allow_reset = validated_invite.additional_data.allow_reset; | 105 local username = validated_invite.username; |
| 106 if username and username ~= event.username then | |
| 107 event.allowed = false; | |
| 108 event.reason = "The chosen username is not valid with this invitation"; | |
| 109 end | |
| 110 local reset_username = validated_invite.additional_data and validated_invite.additional_data.allow_reset; | |
| 111 if reset_username then | |
| 112 if reset_username ~= event.username then | |
| 113 event.allowed = false; | |
| 114 event.reason = "Incorrect username for password reset"; | |
| 115 end | |
| 116 event.allow_reset = reset_username; | |
| 117 end | |
| 106 end | 118 end |
| 107 end); | 119 end); |
| 108 | 120 |
| 109 -- Make a *one-way* subscription. User will see when contact is online, | 121 -- Make a *one-way* subscription. User will see when contact is online, |
| 110 -- contact will not see when user is online. | 122 -- contact will not see when user is online. |