comparison mod_http_admin_api/mod_http_admin_api.lua @ 4396:de55e1475808

mod_http_admin_api: re-add information about invite creator It is now the JID of the user + a made up resource indicating that it was the admin API.
author Jonas Schäfer <jonas@wielicki.name>
date Tue, 26 Jan 2021 16:10:11 +0100
parents ae1d1e352504
children 5bc706c2db8f
comparison
equal deleted inserted replaced
4395:df9bb3d861f9 4396:de55e1475808
118 end 118 end
119 else 119 else
120 options = {}; 120 options = {};
121 end 121 end
122 122
123 local source = event.session.username .. "@" .. module.host .. "/admin_api";
124
123 local invite; 125 local invite;
124 if invite_type == "reset" then 126 if invite_type == "reset" then
125 if not options.username then 127 if not options.username then
126 return 400; 128 return 400;
127 end 129 end
128 invite = invites.create_account_reset(options.username, options.ttl); 130 invite = invites.create_account_reset(options.username, options.ttl);
129 elseif invite_type == "group" then 131 elseif invite_type == "group" then
130 if not options.groups then 132 if not options.groups then
131 return 400; 133 return 400;
132 end 134 end
133 invite = invites.create_group(options.groups, nil, options.ttl); 135 invite = invites.create_group(options.groups, {
136 source = source;
137 }, options.ttl);
134 elseif invite_type == "account" then 138 elseif invite_type == "account" then
135 invite = invites.create_account(options.username, { 139 invite = invites.create_account(options.username, {
140 source = source;
136 groups = options.groups; 141 groups = options.groups;
137 }, options.ttl); 142 }, options.ttl);
138 else 143 else
139 return 400; 144 return 400;
140 end 145 end