# HG changeset patch # User Matthew Wild # Date 1599479560 -3600 # Node ID fe75cc43dfbf7574994998110eacc113bb9c345d # Parent 9d11c18d4d7e6fb5e7bbf3390650375a4706013f mod_easy_invite: Allow account reset invites diff -r 9d11c18d4d7e -r fe75cc43dfbf mod_easy_invite/mod_easy_invite.lua --- a/mod_easy_invite/mod_easy_invite.lua Mon Sep 07 12:52:16 2020 +0100 +++ b/mod_easy_invite/mod_easy_invite.lua Mon Sep 07 12:52:40 2020 +0100 @@ -143,6 +143,9 @@ event.reason = "Registration on this server is through invitation only"; return; end + if validated_invite.additional_data and validated_invite.additional_data.allow_reset then + event.allow_reset = validated_invite.additional_data.allow_reset; + end end); -- Make a *one-way* subscription. User will see when contact is online, @@ -191,6 +194,14 @@ end end); +-- Equivalent of user-registered but for when the account already existed +-- (i.e. password reset) +module:hook("user-password-reset", function (event) + local validated_invite = event.validated_invite or (event.session and event.session.validated_invite); + if not validated_invite then + return; + end + validated_invite:use(); end); do