# HG changeset patch # User Jonas Schäfer # Date 1611590139 -3600 # Node ID a1256e376dcae2bbda122f43e110d9d7636eaf3d # Parent cba8cd5646413837bf907746c23f1c4ab933efd1 mod_invites_register_api: reroute register call The token from the URI was not used anyway. In addition, we now return the resulting JID because it’s the only way to be sure. diff -r cba8cd564641 -r a1256e376dca mod_invites_register_api/mod_invites_register_api.lua --- a/mod_invites_register_api/mod_invites_register_api.lua Mon Jan 25 12:44:20 2021 +0000 +++ b/mod_invites_register_api/mod_invites_register_api.lua Mon Jan 25 16:55:39 2021 +0100 @@ -32,11 +32,7 @@ }); end -function register_with_invite(event, invite_token) - if not invite_token or #invite_token == 0 then - return 404; - end - +function register_with_invite(event) local request, response = event.request, event.response; if not request.body or #request.body == 0 @@ -106,13 +102,15 @@ ip = request.ip; }); - return 200; + return json.encode({ + jid = prepped_username .. "@" .. module.host; + }); end module:provides("http", { default_path = "register_api"; route = { ["GET /invite/*"] = get_invite_info; - ["POST /register/*"] = register_with_invite; + ["POST /register"] = register_with_invite; }; });