Comparison

plugins/mod_register.lua @ 7812:2bc339352dcd

mod_register: Allow 'title' and 'instructions' fields to be customized
author Kim Alvefur <zash@zash.se>
date Thu, 05 Jan 2017 17:39:15 +0100
parent 7754:560d2e758d4c
child 7814:2120d71b0d56
comparison
equal deleted inserted replaced
7809:34ca48325ce7 7812:2bc339352dcd
39 phone = { name = "phone", type = "text-single", label = "Telephone number" }; 39 phone = { name = "phone", type = "text-single", label = "Telephone number" };
40 url = { name = "url", type = "text-single", label = "Webpage" }; 40 url = { name = "url", type = "text-single", label = "Webpage" };
41 date = { name = "date", type = "text-single", label = "Birth date" }; 41 date = { name = "date", type = "text-single", label = "Birth date" };
42 }; 42 };
43 43
44 local title = module:get_option_string("registration_title",
45 "Creating a new account");
46 local instructions = module:get_option_string("registration_instructions",
47 "Choose a username and password for use with this service.");
48
44 local registration_form = dataform_new{ 49 local registration_form = dataform_new{
45 title = "Creating a new account"; 50 title = title;
46 instructions = "Choose a username and password for use with this service."; 51 instructions = instructions;
47 52
48 field_map.username; 53 field_map.username;
49 field_map.password; 54 field_map.password;
50 }; 55 };
51 56
52 local registration_query = st.stanza("query", {xmlns = "jabber:iq:register"}) 57 local registration_query = st.stanza("query", {xmlns = "jabber:iq:register"})
53 :tag("instructions"):text("Choose a username and password for use with this service."):up() 58 :tag("instructions"):text(instructions):up()
54 :tag("username"):up() 59 :tag("username"):up()
55 :tag("password"):up(); 60 :tag("password"):up();
56 61
57 for _, field in ipairs(additional_fields) do 62 for _, field in ipairs(additional_fields) do
58 if type(field) == "table" then 63 if type(field) == "table" then