# HG changeset patch # User Matthew Wild # Date 1599479615 -3600 # Node ID 50644402c6f5726120bcc1be7d9fa30ba286b6c3 # Parent fe75cc43dfbf7574994998110eacc113bb9c345d mod_easy_invite: Rewrite prosodyctl command handler to support new features (from Snikket) diff -r fe75cc43dfbf -r 50644402c6f5 mod_easy_invite/mod_easy_invite.lua --- a/mod_easy_invite/mod_easy_invite.lua Mon Sep 07 12:52:40 2020 +0100 +++ b/mod_easy_invite/mod_easy_invite.lua Mon Sep 07 12:53:35 2020 +0100 @@ -247,7 +247,28 @@ -- Load mod_invites invites = module:context(host):depends("invites"); - local invite = invites.create_account(); - print(invite.uri); + module:context(host):depends("invites_page"); + + table.remove(arg, 1); + table.remove(arg, 1); + + local invite, roles; + if arg[1] == "--reset" then + local nodeprep = require "util.encodings".stringprep.nodeprep; + local username = nodeprep(arg[2]); + if not username then + print("Please supply a valid username to generate a reset link for"); + return; + end + invite = invites.create_account_reset(username); + else + if arg[1] == "--admin" then + roles = { ["prosody:admin"] = true }; + elseif arg[1] == "--role" then + roles = { [arg[2]] = true }; + end + invite = invites.create_account(nil, { roles = roles }); + end + + print(invite.landing_page or invite.uri); end -