🐛 Fix challenge is not stored in the cache

修复 challenge 变量没有存储到 redis 缓存问题
This commit is contained in:
洛水居室 2022-11-13 00:38:37 +08:00
parent 9ed30d4143
commit 80577042da
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC

View File

@ -74,16 +74,17 @@ class SignSystem:
) -> Optional[InlineKeyboardMarkup]: ) -> Optional[InlineKeyboardMarkup]:
if not config.pass_challenge_user_web: if not config.pass_challenge_user_web:
return None return None
if challenge and gt:
await self.set_challenge(uid, gt, challenge)
if not challenge or not gt: if not challenge or not gt:
gt, challenge = await self.get_challenge(uid) gt, challenge = await self.get_challenge(uid)
if not challenge or not gt: if not challenge or not gt:
return None return None
if callback: if callback:
await self.set_challenge(uid, gt, challenge)
data = f"sign|{user_id}|{uid}" data = f"sign|{user_id}|{uid}"
return InlineKeyboardMarkup([[InlineKeyboardButton("请尽快点我进行手动验证", callback_data=data)]]) return InlineKeyboardMarkup([[InlineKeyboardButton("请尽快点我进行手动验证", callback_data=data)]])
else: else:
url = f"{config.pass_challenge_user_web}?username={bot.app.bot.username}&gt={gt}&challenge={challenge}&uid={uid}" url = f"{config.pass_challenge_user_web}?username={bot.app.bot.username}&command=sign&gt={gt}&challenge={challenge}&uid={uid}"
return InlineKeyboardMarkup([[InlineKeyboardButton("请尽快点我进行手动验证", url=url)]]) return InlineKeyboardMarkup([[InlineKeyboardButton("请尽快点我进行手动验证", url=url)]])
@staticmethod @staticmethod