From b9e38f340bc5a83c3207683dc53c447b72556db5 Mon Sep 17 00:00:00 2001 From: wangruidong <940853815@qq.com> Date: Thu, 25 Dec 2025 14:56:34 +0800 Subject: [PATCH] perf: Simplify login and MFA limit key templates by removing IP address --- apps/users/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/users/utils.py b/apps/users/utils.py index 207443c70..292dcc81b 100644 --- a/apps/users/utils.py +++ b/apps/users/utils.py @@ -139,7 +139,7 @@ class BlockUtilBase: username = username.lower() if username else '' self.username = username self.ip = ip - self.limit_key = self.LIMIT_KEY_TMPL.format(username, ip) + self.limit_key = self.LIMIT_KEY_TMPL.format(username) self.block_key = self.BLOCK_KEY_TMPL.format(username) self.key_ttl = int(settings.SECURITY_LOGIN_LIMIT_TIME) * 60 @@ -236,12 +236,12 @@ class BlockGlobalIpUtilBase: class LoginBlockUtil(BlockUtilBase): - LIMIT_KEY_TMPL = "_LOGIN_LIMIT_{}_{}" + LIMIT_KEY_TMPL = "_LOGIN_LIMIT_{}" BLOCK_KEY_TMPL = "_LOGIN_BLOCK_{}" class MFABlockUtils(BlockUtilBase): - LIMIT_KEY_TMPL = "_MFA_LIMIT_{}_{}" + LIMIT_KEY_TMPL = "_MFA_LIMIT_{}" BLOCK_KEY_TMPL = "_MFA_BLOCK_{}"