Skip to content

Commit 551dc51

Browse files
authored
Restore captcha uuid naming in the login params (#928)
1 parent 0729061 commit 551dc51

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

backend/app/admin/schema/user.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class AuthSchemaBase(SchemaBase):
2020
class AuthLoginParam(AuthSchemaBase):
2121
"""用户登录参数"""
2222

23-
captcha_uuid: str | None = Field(None, description='验证码 UUID')
23+
uuid: str | None = Field(None, description='验证码 UUID')
2424
captcha: str | None = Field(None, description='验证码')
2525

2626

backend/app/admin/service/auth_service.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,14 @@ async def login(
103103

104104
await load_login_config(db)
105105
if settings.LOGIN_CAPTCHA_ENABLED:
106-
if not obj.captcha_uuid or not obj.captcha:
106+
if not obj.uuid or not obj.captcha:
107107
raise errors.RequestError(msg=t('error.captcha.invalid'))
108-
captcha_code = await redis_client.get(f'{settings.LOGIN_CAPTCHA_REDIS_PREFIX}:{obj.captcha_uuid}')
108+
captcha_code = await redis_client.get(f'{settings.LOGIN_CAPTCHA_REDIS_PREFIX}:{obj.uuid}')
109109
if not captcha_code:
110110
raise errors.RequestError(msg=t('error.captcha.expired'))
111111
if captcha_code.lower() != obj.captcha.lower():
112112
raise errors.CustomError(error=CustomErrorCode.CAPTCHA_ERROR)
113-
await redis_client.delete(f'{settings.LOGIN_CAPTCHA_REDIS_PREFIX}:{obj.captcha_uuid}')
113+
await redis_client.delete(f'{settings.LOGIN_CAPTCHA_REDIS_PREFIX}:{obj.uuid}')
114114

115115
await user_dao.update_login_time(db, obj.username)
116116
await db.refresh(user)

0 commit comments

Comments
 (0)