aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-03-10 02:28:29 +0100
committerKim Alvefur <zash@zash.se>2018-03-10 02:28:29 +0100
commitbc7b88dba9a5ff1484a38789f3c2734cb122db3c (patch)
tree56cc89328f7aca87bd6a789ea944347ad7e57f93
parent667f72d28c16d72e71e82368faad5e84b0525e80 (diff)
downloadprosody-bc7b88dba9a5ff1484a38789f3c2734cb122db3c.tar.gz
prosody-bc7b88dba9a5ff1484a38789f3c2734cb122db3c.zip
mod_register_limits: Return reason for disallowing
-rw-r--r--plugins/mod_register_limits.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/plugins/mod_register_limits.lua b/plugins/mod_register_limits.lua
index 94e2b381..685a84bd 100644
--- a/plugins/mod_register_limits.lua
+++ b/plugins/mod_register_limits.lua
@@ -63,13 +63,16 @@ module:hook("user-registering", function (event)
elseif ip_in_set(blacklisted_ips, event.ip) then
log("debug", "Registration disallowed by blacklist");
event.allowed = false;
+ event.reason = "Your IP address is blacklisted";
elseif (whitelist_only and not ip_in_set(whitelisted_ips, ip)) then
log("debug", "Registration disallowed by whitelist");
event.allowed = false;
+ event.reason = "Your IP address is not whitelisted";
elseif throttle_max and not ip_in_set(whitelisted_ips, ip) then
if not check_throttle(event.ip) then
log("debug", "Registrations over limit for ip %s", ip or "?");
event.allowed = false;
+ event.reason = "Too many registrations from this IP address recently";
end
end
end);