From 35e9bfb8ab08c3ec8c43e3efdee3db72d1bcc00f Mon Sep 17 00:00:00 2001 From: Florent Daigniere Date: Sat, 4 Feb 2023 16:54:25 +0100 Subject: [PATCH] Clarify --- core/admin/mailu/limiter.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/core/admin/mailu/limiter.py b/core/admin/mailu/limiter.py index 85891ee3..2d8380ad 100644 --- a/core/admin/mailu/limiter.py +++ b/core/admin/mailu/limiter.py @@ -56,10 +56,9 @@ class LimitWraperFactory(object): limiter = self.get_limiter(app.config['AUTH_RATELIMIT_IP'], 'auth-ip') client_network = utils.extract_network_from_ip(ip) if self.is_subject_to_rate_limits(ip): - if username and (self.storage.get(f'dedup-{client_network}-{username}') > 0): - return - self.storage.incr(f'dedup-{client_network}-{username}', limits.parse(app.config['AUTH_RATELIMIT_IP']).GRANULARITY.seconds ,True) - limiter.hit(client_network) + if username and (self.storage.get(f'dedup-{client_network}-{username}') < 1): + self.storage.incr(f'dedup-{client_network}-{username}', limits.parse(app.config['AUTH_RATELIMIT_IP']).GRANULARITY.seconds ,True) + limiter.hit(client_network) def should_rate_limit_user(self, username, ip, device_cookie=None, device_cookie_name=None): limiter = self.get_limiter(app.config["AUTH_RATELIMIT_USER"], 'auth-user')