fix: add mark_used parameter to check_sms_code for multi-account login flow
When multiple accounts share a phone number, the first SMS code check should verify without consuming the code, so the second call (after account selection) can re-verify. Default mark_used=True preserves backward compatibility.
This commit is contained in:
parent
e95e3b8893
commit
bbd10a6471
@ -182,7 +182,7 @@ class SMSEngine:
|
|||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
async def check_sms_code(self, code_id: str, vcode: str) -> bool:
|
async def check_sms_code(self, code_id: str, vcode: str, mark_used: bool = True) -> bool:
|
||||||
env = ServerEnv()
|
env = ServerEnv()
|
||||||
async with get_sor_context(env, 'smssend') as sor:
|
async with get_sor_context(env, 'smssend') as sor:
|
||||||
code_info = await sor.R('validatecode', {'id': code_id})
|
code_info = await sor.R('validatecode', {'id': code_id})
|
||||||
@ -204,7 +204,8 @@ class SMSEngine:
|
|||||||
debug(f'check_sms_code():timeout ')
|
debug(f'check_sms_code():timeout ')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
await sor.U('validatecode', {'id': code_id, 'del_flg': '1'})
|
if mark_used:
|
||||||
|
await sor.U('validatecode', {'id': code_id, 'del_flg': '1'})
|
||||||
debug(f'check_sms_code(): return True ')
|
debug(f'check_sms_code(): return True ')
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user