comparison mod_http_admin_api/mod_http_admin_api.lua @ 4359:5dbce7f35aa0

mod_http_admin_api: Fix logic bug
author Matthew Wild <mwild1@gmail.com>
date Tue, 19 Jan 2021 20:35:33 +0000
parents d3e0fe470877
children 76bec3f66b24
comparison
equal deleted inserted replaced
4358:d3e0fe470877 4359:5dbce7f35aa0
110 invite_options = json.decode(event.request.body); 110 invite_options = json.decode(event.request.body);
111 if not invite_options then 111 if not invite_options then
112 module:log("warn", "Invalid JSON"); 112 module:log("warn", "Invalid JSON");
113 return 400; 113 return 400;
114 end 114 end
115 else
116 invite_options = {};
115 end 117 end
116 118
117 local invite; 119 local invite;
118 if invite_options and invite_options.reusable then 120 if invite_options.reusable then
119 invite = invites.create_group(invite_options.groups, invite_options.ttl, { 121 invite = invites.create_group(invite_options.groups, invite_options.ttl, {
120 source = "admin_api/"..event.session.username; 122 source = "admin_api/"..event.session.username;
121 }); 123 });
122 else 124 else
123 invite = invites.create_account(nil, { 125 invite = invites.create_account(nil, {