diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2019-09-29 15:26:18 +0200 |
---|---|---|
committer | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2019-09-29 15:26:18 +0200 |
commit | 21cbe37ca6791b24be7098c5b1ea02171f2579cc (patch) | |
tree | 4f8d90d0e3289005589a3703b3f1476589a1f5b6 | |
parent | 8791fa6eca2b7e44f12e9e716900235c46e664ce (diff) | |
download | prosody-21cbe37ca6791b24be7098c5b1ea02171f2579cc.tar.gz prosody-21cbe37ca6791b24be7098c5b1ea02171f2579cc.zip |
mod_register_ibr, mod_register_limits: Add support for custom error type and defined-condition.
-rw-r--r-- | plugins/mod_register_ibr.lua | 2 | ||||
-rw-r--r-- | plugins/mod_register_limits.lua | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/plugins/mod_register_ibr.lua b/plugins/mod_register_ibr.lua index e04e6ecd..fe5ede2b 100644 --- a/plugins/mod_register_ibr.lua +++ b/plugins/mod_register_ibr.lua @@ -168,7 +168,7 @@ module:hook("stanza/iq/jabber:iq:register:query", function(event) module:fire_event("user-registering", user); if not user.allowed then log("debug", "Registration disallowed by module: %s", user.reason or "no reason given"); - session.send(st.error_reply(stanza, "modify", "not-acceptable", user.reason)); + session.send(st.error_reply(stanza, user.error_type or "modify", user.error_condition or "not-acceptable", user.reason)); return true; end diff --git a/plugins/mod_register_limits.lua b/plugins/mod_register_limits.lua index 736282a5..55811d74 100644 --- a/plugins/mod_register_limits.lua +++ b/plugins/mod_register_limits.lua @@ -64,15 +64,21 @@ module:hook("user-registering", function (event) 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); |