Mercurial > prosody-modules
comparison mod_easy_invite/mod_easy_invite.lua @ 4085:fe75cc43dfbf
mod_easy_invite: Allow account reset invites
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 07 Sep 2020 12:52:40 +0100 |
parents | 9d11c18d4d7e |
children | 50644402c6f5 |
comparison
equal
deleted
inserted
replaced
4084:9d11c18d4d7e | 4085:fe75cc43dfbf |
---|---|
141 if invite_only and not validated_invite then | 141 if invite_only and not validated_invite then |
142 event.allowed = false; | 142 event.allowed = false; |
143 event.reason = "Registration on this server is through invitation only"; | 143 event.reason = "Registration on this server is through invitation only"; |
144 return; | 144 return; |
145 end | 145 end |
146 if validated_invite.additional_data and validated_invite.additional_data.allow_reset then | |
147 event.allow_reset = validated_invite.additional_data.allow_reset; | |
148 end | |
146 end); | 149 end); |
147 | 150 |
148 -- Make a *one-way* subscription. User will see when contact is online, | 151 -- Make a *one-way* subscription. User will see when contact is online, |
149 -- contact will not see when user is online. | 152 -- contact will not see when user is online. |
150 function subscribe(host, user_username, contact_username) | 153 function subscribe(host, user_username, contact_username) |
189 module:open_store("roles"):set(contact_username, roles); | 192 module:open_store("roles"):set(contact_username, roles); |
190 end | 193 end |
191 end | 194 end |
192 end); | 195 end); |
193 | 196 |
197 -- Equivalent of user-registered but for when the account already existed | |
198 -- (i.e. password reset) | |
199 module:hook("user-password-reset", function (event) | |
200 local validated_invite = event.validated_invite or (event.session and event.session.validated_invite); | |
201 if not validated_invite then | |
202 return; | |
203 end | |
204 validated_invite:use(); | |
194 end); | 205 end); |
195 | 206 |
196 do | 207 do |
197 -- Telnet command | 208 -- Telnet command |
198 -- Since the telnet console is global this overwrites the command for | 209 -- Since the telnet console is global this overwrites the command for |