aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-01-11 07:15:42 +0000
committerMatthew Wild <mwild1@gmail.com>2009-01-11 07:15:42 +0000
commit7381cd9804f3a6fa6eaabdf1016115a8c6f8d46c (patch)
treeb6a08132daef59ca4dae0f6ea31e7a64ce87b913 /plugins
parent7bd422b3881a111edbb069435c72225d71264e7a (diff)
downloadprosody-7381cd9804f3a6fa6eaabdf1016115a8c6f8d46c.tar.gz
prosody-7381cd9804f3a6fa6eaabdf1016115a8c6f8d46c.zip
Add option to in-band registration to allow only whitelisted IPs to register
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_register.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/plugins/mod_register.lua b/plugins/mod_register.lua
index 250be65d..44bbf700 100644
--- a/plugins/mod_register.lua
+++ b/plugins/mod_register.lua
@@ -96,6 +96,7 @@ end);
local recent_ips = {};
local min_seconds_between_registrations = config.get(module.host, "core", "min_seconds_between_registrations");
+local whitelist_only = config.get(module.host, "core", "whitelist_registration_only");
local whitelisted_ips = config.get(module.host, "core", "registration_whitelist") or { "127.0.0.1" };
local blacklisted_ips = config.get(module.host, "core", "registration_blacklist") or {};
@@ -122,7 +123,7 @@ module:add_iq_handler("c2s_unauthed", "jabber:iq:register", function (session, s
local password = query:child_with_name("password");
if username and password then
-- Check that the user is not blacklisted or registering too often
- if blacklisted_ips[session.ip] then
+ if blacklisted_ips[session.ip] or (whitelist_only and not whitelisted_ips[session.ip]) then
session.send(st.error_reply(stanza, "cancel", "not-acceptable"));
return;
elseif min_seconds_between_registrations and not whitelisted_ips[session.ip] then