Software / code / prosody
Diff
plugins/mod_register_limits.lua @ 10286:23b26a414d71
mod_register_ibr, mod_register_limits: Add support for custom error type and defined-condition.
| author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
|---|---|
| date | Sun, 29 Sep 2019 15:26:18 +0200 |
| parent | 8740:5dc8f509496c |
| child | 10364:66943afdd7f3 |
line wrap: on
line diff
--- a/plugins/mod_register_limits.lua Sun Sep 29 15:51:21 2019 +0200 +++ b/plugins/mod_register_limits.lua Sun Sep 29 15:26:18 2019 +0200 @@ -64,15 +64,21 @@ log("debug", "Registration disallowed by blacklist"); event.allowed = false; event.reason = "Your IP address is blacklisted"; + event.error_type = "auth"; + event.error_condition = "forbidden"; 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"; + event.error_type = "auth"; + event.error_condition = "forbidden"; elseif throttle_max and not ip_in_set(whitelisted_ips, ip) then if not check_throttle(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"; + event.error_type = "wait"; + event.error_condition = "policy-violation"; end end end);