From 3c1764e58dc8a3504f8c0fb9b72fa5a9e0e60197 Mon Sep 17 00:00:00 2001 From: mkg <1650473152@qq.com> Date: Thu, 26 Aug 2021 12:12:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E5=BD=A2=E9=AA=8C=E8=AF=81=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- applications/common/utils/gen_captcha.py | 2 +- applications/view/passport/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/applications/common/utils/gen_captcha.py b/applications/common/utils/gen_captcha.py index 12c490e..068aa58 100644 --- a/applications/common/utils/gen_captcha.py +++ b/applications/common/utils/gen_captcha.py @@ -8,7 +8,7 @@ def gen_captcha(content='2345689abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWX """ 生成验证码 """ image = ImageCaptcha() # 获取字符串 - captcha_text = "".join(choices(content, k=4)) + captcha_text = "".join(choices(content, k=4)).lower() # 生成图像 captcha_image = Image.open(image.generate(captcha_text)) return captcha_text, captcha_image diff --git a/applications/view/passport/__init__.py b/applications/view/passport/__init__.py index 51552a7..16a971d 100644 --- a/applications/view/passport/__init__.py +++ b/applications/view/passport/__init__.py @@ -35,7 +35,7 @@ def login_post(): req = request.form username = req.get('username') password = req.get('password') - code = req.get('captcha') + code = req.get('captcha').__str__().lower() if not username or not password or not code: return fail_api(msg="用户名或密码没有输入")