Software /
code /
prosody-modules
Changeset
32:00d5e133c84d
mod_adhoc_cmd_admin: switch to utils.dataforms. Thanks MattJ for making this possible ;)
author | Florian Zeitz <florob@babelmonkeys.de> |
---|---|
date | Sat, 10 Oct 2009 03:24:41 +0200 |
parents | 30:fc4806a98fc4 |
children | 33:f3225c55288f |
files | mod_adhoc_cmd_admin/mod_adhoc_cmd_admin.lua |
diffstat | 1 files changed, 8 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_adhoc_cmd_admin/mod_adhoc_cmd_admin.lua Fri Oct 09 23:23:54 2009 +0200 +++ b/mod_adhoc_cmd_admin/mod_adhoc_cmd_admin.lua Sat Oct 10 03:24:41 2009 +0200 @@ -5,6 +5,7 @@ -- local st, jid, uuid = require "util.stanza", require "util.jid", require "util.uuid"; +local dataforms_new = require "util.dataforms".new; local usermanager_user_exists = require "core.usermanager".user_exists; local usermanager_create_user = require "core.usermanager".create_user; @@ -36,16 +37,13 @@ break; end end - local fields = {}; - for _, field in ipairs(form.tags) do - if field.name == "field" and field.attr.var then - for i, tag in ipairs(field.tags) do - if tag.name == "value" and #tag.tags == 0 then - fields[field.attr.var] = tag[1] or ""; - end - end - end - end + local layout = { + { name = "accountjid", type = "jid-single" }; + { name = "password", type = "text-private" }; + { name = "password-verify", type = "text-private" }; + }; + dataforms_new(layout); + local fields = layout:data(form); local username, host, resource = jid.split(fields.accountjid); if (fields.password == fields["password-verify"]) and username and host and host == stanza.attr.to then if usermanager_user_exists(username, host) then