Software / code / prosody
Comparison
plugins/mod_register.lua @ 7710:08f5b483ff00
mod_register: Use throttle_max as indicator of limits being enabled, in case min_seconds_between_registrations is not used
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Wed, 02 Nov 2016 13:30:45 +0100 |
| parent | 7709:0af1783d1592 |
| child | 7711:c8130995d4d1 |
comparison
equal
deleted
inserted
replaced
| 7709:0af1783d1592 | 7710:08f5b483ff00 |
|---|---|
| 228 if not session.ip then | 228 if not session.ip then |
| 229 log("debug", "User's IP not known; can't apply blacklist/whitelist"); | 229 log("debug", "User's IP not known; can't apply blacklist/whitelist"); |
| 230 elseif blacklisted_ips[session.ip] or (whitelist_only and not whitelisted_ips[session.ip]) then | 230 elseif blacklisted_ips[session.ip] or (whitelist_only and not whitelisted_ips[session.ip]) then |
| 231 session.send(st.error_reply(stanza, "cancel", "not-acceptable", "You are not allowed to register an account.")); | 231 session.send(st.error_reply(stanza, "cancel", "not-acceptable", "You are not allowed to register an account.")); |
| 232 return true; | 232 return true; |
| 233 elseif min_seconds_between_registrations and not whitelisted_ips[session.ip] then | 233 elseif throttle_max and not whitelisted_ips[session.ip] then |
| 234 if not check_throttle(session.ip) then | 234 if not check_throttle(session.ip) then |
| 235 log("debug", "Registrations over limit for ip %s", session.ip or "?"); | 235 log("debug", "Registrations over limit for ip %s", session.ip or "?"); |
| 236 session.send(st.error_reply(stanza, "wait", "not-acceptable")); | 236 session.send(st.error_reply(stanza, "wait", "not-acceptable")); |
| 237 return true; | 237 return true; |
| 238 end | 238 end |