]> Untitled Git - lemmy.git/commitdiff
Fix rate limit check for register. Fixes #2159
authorDessalines <tyhou13@gmx.com>
Thu, 24 Mar 2022 20:13:58 +0000 (16:13 -0400)
committerDessalines <tyhou13@gmx.com>
Thu, 24 Mar 2022 20:13:58 +0000 (16:13 -0400)
crates/utils/src/rate_limit/mod.rs

index d56dc0c5e8ea33e64a115efe02af892a160a37f1..55a1ae8a01f54e291b6911bfa8691a0ad463b019 100644 (file)
@@ -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
   }
 }