From: Dessalines Date: Thu, 24 Mar 2022 20:13:58 +0000 (-0400) Subject: Fix rate limit check for register. Fixes #2159 X-Git-Url: http://these/git/readmes/%24%7Bk%5B1%5D.custom_emoji.image_url%7D?a=commitdiff_plain;h=ed9f70276daa8831d90b2603135ccf323c86252e;p=lemmy.git Fix rate limit check for register. Fixes #2159 --- diff --git a/crates/utils/src/rate_limit/mod.rs b/crates/utils/src/rate_limit/mod.rs index d56dc0c5..55a1ae8a 100644 --- a/crates/utils/src/rate_limit/mod.rs +++ b/crates/utils/src/rate_limit/mod.rs @@ -98,7 +98,7 @@ impl RateLimited { &ip_addr, rate_limit.post, rate_limit.post_per_second, - true, + false, )?; } RateLimitType::Register => { @@ -107,7 +107,7 @@ impl RateLimited { &ip_addr, rate_limit.register, rate_limit.register_per_second, - true, + false, )?; } RateLimitType::Image => { @@ -133,34 +133,6 @@ impl RateLimited { let res = fut.await; - // after - { - let mut limiter = self.rate_limiter.lock().await; - if res.is_ok() { - match self.type_ { - RateLimitType::Post => { - limiter.check_rate_limit_full( - self.type_, - &ip_addr, - rate_limit.post, - rate_limit.post_per_second, - false, - )?; - } - RateLimitType::Register => { - limiter.check_rate_limit_full( - self.type_, - &ip_addr, - rate_limit.register, - rate_limit.register_per_second, - false, - )?; - } - _ => (), - }; - } - } - res } }