Software /
code /
prosody
Changeset
691:406b070b5d3e
Add option to in-band registration to allow only whitelisted IPs to register
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 11 Jan 2009 07:15:42 +0000 |
parents | 690:e901a0709005 |
children | 692:4a218377f4e3 |
files | plugins/mod_register.lua |
diffstat | 1 files changed, 2 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_register.lua Sun Jan 11 07:09:25 2009 +0000 +++ b/plugins/mod_register.lua Sun Jan 11 07:15:42 2009 +0000 @@ -96,6 +96,7 @@ 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 @@ 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