# HG changeset patch # User Marco Cirillo # Date 1303051940 0 # Node ID 1f55e844efebf77107fedd130170fea81ecc52e8 # Parent a6dee73a11e79fe8bb91303281febeedd6f32448 mod_register_url: added option to specify no whitelististing is employed. diff -r a6dee73a11e7 -r 1f55e844efeb mod_register_url/mod_register_url.lua --- a/mod_register_url/mod_register_url.lua Wed Apr 13 20:41:53 2011 +0200 +++ b/mod_register_url/mod_register_url.lua Sun Apr 17 14:52:20 2011 +0000 @@ -7,14 +7,18 @@ function reg_redirect(event) local ip_wl = module:get_option("registration_whitelist") or { "127.0.0.1" }; local url = module:get_option("registration_url"); - local test_ip; + local no_wl = module:get_option("no_registration_whitelist") or false; + if type(no_wl) ~= boolean then no_wl = false end + local test_ip = false; - for i,ip in ipairs(ip_wl) do - if event.origin.ip == ip then test_ip = true; end - break; + if not no_wl then + for i,ip in ipairs(ip_wl) do + if event.origin.ip == ip then test_ip = true; end + break; + end end - if not test_ip and url ~= nil then + if not test_ip and url ~= nil or no_wl and url ~= nil then local reply = st.reply(event.stanza); reply:tag("query", {xmlns = "jabber:iq:register"}) :tag("instructions"):text("Please visit "..url.." to register an account on this server."):up()