mirror of
https://github.com/bjc/prosody.git
synced 2025-04-07 07:07:38 +03:00
mod_register_limits: Use existing local variable
This commit is contained in:
parent
34a61dd7c6
commit
6ce8da708c
1 changed files with 2 additions and 2 deletions
|
@ -60,7 +60,7 @@ module:hook("user-registering", function (event)
|
||||||
local log = session and session.log or module._log;
|
local log = session and session.log or module._log;
|
||||||
if not ip then
|
if not ip then
|
||||||
log("debug", "User's IP not known; can't apply blacklist/whitelist");
|
log("debug", "User's IP not known; can't apply blacklist/whitelist");
|
||||||
elseif ip_in_set(blacklisted_ips, event.ip) then
|
elseif ip_in_set(blacklisted_ips, ip) then
|
||||||
log("debug", "Registration disallowed by blacklist");
|
log("debug", "Registration disallowed by blacklist");
|
||||||
event.allowed = false;
|
event.allowed = false;
|
||||||
event.reason = "Your IP address is blacklisted";
|
event.reason = "Your IP address is blacklisted";
|
||||||
|
@ -69,7 +69,7 @@ module:hook("user-registering", function (event)
|
||||||
event.allowed = false;
|
event.allowed = false;
|
||||||
event.reason = "Your IP address is not whitelisted";
|
event.reason = "Your IP address is not whitelisted";
|
||||||
elseif throttle_max and not ip_in_set(whitelisted_ips, ip) then
|
elseif throttle_max and not ip_in_set(whitelisted_ips, ip) then
|
||||||
if not check_throttle(event.ip) then
|
if not check_throttle(ip) then
|
||||||
log("debug", "Registrations over limit for ip %s", ip or "?");
|
log("debug", "Registrations over limit for ip %s", ip or "?");
|
||||||
event.allowed = false;
|
event.allowed = false;
|
||||||
event.reason = "Too many registrations from this IP address recently";
|
event.reason = "Too many registrations from this IP address recently";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue