Software / code / prosody-modules
Comparison
mod_invites/mod_invites.lua @ 4422:2047dd56cc40
mod_invites: add extensive help message
| author | Jonas Schäfer <jonas@wielicki.name> |
|---|---|
| date | Mon, 01 Feb 2021 16:43:27 +0100 |
| parent | 4421:94805a7e7b30 |
| child | 5976:8ac59766ece1 |
comparison
equal
deleted
inserted
replaced
| 4421:94805a7e7b30 | 4422:2047dd56cc40 |
|---|---|
| 260 local groups = {}; | 260 local groups = {}; |
| 261 | 261 |
| 262 while #arg > 0 do | 262 while #arg > 0 do |
| 263 local value = arg[1]; | 263 local value = arg[1]; |
| 264 table.remove(arg, 1); | 264 table.remove(arg, 1); |
| 265 if value == "--reset" then | 265 if value == "--help" then |
| 266 print("usage: prosodyctl mod_"..module.name.." generate DOMAIN --reset USERNAME") | |
| 267 print("usage: prosodyctl mod_"..module.name.." generate DOMAIN [--admin] [--role ROLE] [--group GROUPID]...") | |
| 268 print() | |
| 269 print("This command has two modes: password reset and new account.") | |
| 270 print("If --reset is given, the command operates in password reset mode and in new account mode otherwise.") | |
| 271 print() | |
| 272 print("required arguments in password reset mode:") | |
| 273 print() | |
| 274 print(" --reset USERNAME Generate a password reset link for the given USERNAME.") | |
| 275 print() | |
| 276 print("optional arguments in new account mode:") | |
| 277 print() | |
| 278 print(" --admin Make the new user privileged") | |
| 279 print(" Equivalent to --role prosody:admin") | |
| 280 print(" --role ROLE Grant the given ROLE to the new user") | |
| 281 print(" --group GROUPID Add the user to the group with the given ID") | |
| 282 print(" Can be specified multiple times") | |
| 283 print() | |
| 284 print("--role and --admin override each other; the last one wins") | |
| 285 print("--group can be specified multiple times; the user will be added to all groups.") | |
| 286 print() | |
| 287 print("--reset and the other options cannot be mixed.") | |
| 288 return 2 | |
| 289 elseif value == "--reset" then | |
| 266 local nodeprep = require "util.encodings".stringprep.nodeprep; | 290 local nodeprep = require "util.encodings".stringprep.nodeprep; |
| 267 local username = nodeprep(arg[1]) | 291 local username = nodeprep(arg[1]) |
| 268 table.remove(arg, 1); | 292 table.remove(arg, 1); |
| 269 if not username then | 293 if not username then |
| 270 print("Please supply a valid username to generate a reset link for"); | 294 print("Please supply a valid username to generate a reset link for"); |