Mercurial > prosody-hg
comparison plugins/mod_invites.lua @ 14015:42e035cd3322
Merge 13.0->trunk
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Fri, 19 Dec 2025 14:50:10 +0000 |
| parents | b019a30cc1b2 f0b2a05bcedc |
| children | 13b3220c3282 |
comparison
equal
deleted
inserted
replaced
| 14013:fbfc06c5f3a8 | 14015:42e035cd3322 |
|---|---|
| 1 local id = require "prosody.util.id"; | 1 local id = require "prosody.util.id"; |
| 2 local it = require "prosody.util.iterators"; | 2 local it = require "prosody.util.iterators"; |
| 3 local usermanager = require "prosody.core.usermanager"; | |
| 3 local url = require "socket.url"; | 4 local url = require "socket.url"; |
| 4 local jid_node = require "prosody.util.jid".node; | 5 local jid_node = require "prosody.util.jid".node; |
| 5 local jid_split = require "prosody.util.jid".split; | 6 local jid_split = require "prosody.util.jid".split; |
| 6 local argparse = require "prosody.util.argparse"; | 7 local argparse = require "prosody.util.argparse"; |
| 7 local human_io = require "prosody.util.human.io"; | 8 local human_io = require "prosody.util.human.io"; |
| 300 flags = { | 301 flags = { |
| 301 value_params = { expires_after = true }; | 302 value_params = { expires_after = true }; |
| 302 }; | 303 }; |
| 303 | 304 |
| 304 handler = function (self, user_jid, opts) --luacheck: ignore 212/self | 305 handler = function (self, user_jid, opts) --luacheck: ignore 212/self |
| 305 local username = jid_split(user_jid); | 306 local username, host = jid_split(user_jid); |
| 306 if not username then | 307 if not username then |
| 307 return nil, "Supply the JID of the account you want to generate a password reset for"; | 308 return nil, "Supply the JID of the account you want to generate a password reset for"; |
| 309 end | |
| 310 if not usermanager.user_exists(username, host) then | |
| 311 return nil, "The specified user account does not exist: " .. username; | |
| 308 end | 312 end |
| 309 local duration_sec = require "prosody.util.human.io".parse_duration(opts and opts.expires_after or "1d"); | 313 local duration_sec = require "prosody.util.human.io".parse_duration(opts and opts.expires_after or "1d"); |
| 310 if not duration_sec then | 314 if not duration_sec then |
| 311 return nil, "Unable to parse duration: "..opts.expires_after; | 315 return nil, "Unable to parse duration: "..opts.expires_after; |
| 312 end | 316 end |
