aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-01-09 10:17:39 +0100
committerKim Alvefur <zash@zash.se>2017-01-09 10:17:39 +0100
commitc3d9a2c11d362fcd1677d169af395c1f7bb8d4f1 (patch)
treef74647d6ef7f599b9f5283ae25b85c10ac124a2e /plugins
parentea5d14cb81bd618da08e46fc4a314379d8df46ca (diff)
parent9aed5f791f903dd1d5bd997fcb15bcece4c8e9e4 (diff)
downloadprosody-c3d9a2c11d362fcd1677d169af395c1f7bb8d4f1.tar.gz
prosody-c3d9a2c11d362fcd1677d169af395c1f7bb8d4f1.zip
Merge 0.10->trunk
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_register.lua17
1 files changed, 12 insertions, 5 deletions
diff --git a/plugins/mod_register.lua b/plugins/mod_register.lua
index c376117f..ee3f88ba 100644
--- a/plugins/mod_register.lua
+++ b/plugins/mod_register.lua
@@ -41,30 +41,37 @@ local field_map = {
date = { name = "date", type = "text-single", label = "Birth date" };
};
+local title = module:get_option_string("registration_title",
+ "Creating a new account");
+local instructions = module:get_option_string("registration_instructions",
+ "Choose a username and password for use with this service.");
+
local registration_form = dataform_new{
- title = "Creating a new account";
- instructions = "Choose a username and password for use with this service.";
+ title = title;
+ instructions = instructions;
field_map.username;
field_map.password;
};
local registration_query = st.stanza("query", {xmlns = "jabber:iq:register"})
- :tag("instructions"):text("Choose a username and password for use with this service."):up()
+ :tag("instructions"):text(instructions):up()
:tag("username"):up()
:tag("password"):up();
for _, field in ipairs(additional_fields) do
if type(field) == "table" then
registration_form[#registration_form + 1] = field;
- else
+ elseif field_map[field] or field_map[field:sub(1, -2)] then
if field:match("%+$") then
- field = field:sub(1, #field - 1);
+ field = field:sub(1, -2);
field_map[field].required = true;
end
registration_form[#registration_form + 1] = field_map[field];
registration_query:tag(field):up();
+ else
+ module:log("error", "Unknown field %q", field);
end
end
registration_query:add_child(registration_form:form());