Skip to content

Commit

Permalink
Update to layer 152
Browse files Browse the repository at this point in the history
  • Loading branch information
Lonami committed Feb 5, 2023
1 parent 9f077e3 commit 6dece6e
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 17 deletions.
7 changes: 7 additions & 0 deletions telethon/client/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,10 @@ async def send_code_request(
return await self.send_code_request(
phone, force_sms=force_sms, _retry_count=_retry_count+1)

# TODO figure out when/if/how this can happen
if isinstance(result, types.auth.SentCodeSuccess):
raise RuntimeError('logged in right after sending the code')

# If we already sent a SMS, do not resend the code (hash may be empty)
if isinstance(result.type, types.auth.SentCodeTypeSms):
force_sms = False
Expand All @@ -550,6 +554,9 @@ async def send_code_request(
return await self.send_code_request(
phone, force_sms=False, _retry_count=_retry_count+1)

if isinstance(result, types.auth.SentCodeSuccess):
raise RuntimeError('logged in right after resending the code')

self._phone_code_hash[phone] = result.phone_code_hash

return result
Expand Down
Loading

0 comments on commit 6dece6e

Please sign in to comment.