# HG changeset patch # User Maxime “pep” Buquet # Date 1589747935 -7200 # Node ID 7e2db4d61f6ca7ee324c67af60734cfab55eb4dc # Parent 3ac31ddab7eb1d547ae23c138477843f400b8857 mod_easy_invite: backport: ensure session exists before accessing it Backport from https://github.com/snikket-im/snikket-server This prevents a 500 issue when using mod_register_web. diff -r 3ac31ddab7eb -r 7e2db4d61f6c mod_easy_invite/mod_easy_invite.lua --- a/mod_easy_invite/mod_easy_invite.lua Sat May 16 19:48:26 2020 +0200 +++ b/mod_easy_invite/mod_easy_invite.lua Sun May 17 22:38:55 2020 +0200 @@ -137,7 +137,7 @@ -- Registration attempt - ensure a valid preauth token has been supplied module:hook("user-registering", function (event) - local validated_invite = event.session.validated_invite; + local validated_invite = event.validated_invite or (event.session and event.session.validated_invite); if invite_only and not validated_invite then event.allowed = false; event.reason = "Registration on this server is through invitation only"; @@ -169,7 +169,7 @@ -- Registration successful, if there was a preauth token, mark it as used module:hook("user-registered", function (event) - local validated_invite = event.session.validated_invite; + local validated_invite = event.validated_invite or (event.session and event.session.validated_invite); if not validated_invite then return; end