mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-07-01 10:53:09 +03:00
Fix sign_up call to sign_in
This commit is contained in:
parent
94ac667e79
commit
80d44cb75b
|
@ -248,10 +248,9 @@ async def sign_up(
|
||||||
*,
|
*,
|
||||||
code: typing.Union[str, int]) -> '_tl.User':
|
code: typing.Union[str, int]) -> '_tl.User':
|
||||||
if not self._phone_code_hash:
|
if not self._phone_code_hash:
|
||||||
|
# This check is also present in sign_in but we do it here to customize the error message
|
||||||
raise ValueError('Must call client.send_code_request before sign up')
|
raise ValueError('Must call client.send_code_request before sign up')
|
||||||
|
|
||||||
phone, phone_code_hash = self._phone_code_hash
|
|
||||||
|
|
||||||
# To prevent abuse, one has to try to sign in before signing up. This
|
# To prevent abuse, one has to try to sign in before signing up. This
|
||||||
# is the current way in which Telegram validates the code to sign up.
|
# is the current way in which Telegram validates the code to sign up.
|
||||||
#
|
#
|
||||||
|
@ -261,11 +260,7 @@ async def sign_up(
|
||||||
# We're emulating pre-layer 104 behaviour so except the right error:
|
# We're emulating pre-layer 104 behaviour so except the right error:
|
||||||
if not self._tos:
|
if not self._tos:
|
||||||
try:
|
try:
|
||||||
return await self.sign_in(
|
return await self.sign_in(code=code)
|
||||||
phone=phone,
|
|
||||||
code=code,
|
|
||||||
phone_code_hash=phone_code_hash,
|
|
||||||
)
|
|
||||||
except errors.SignUpRequired:
|
except errors.SignUpRequired:
|
||||||
pass # code is correct and was used, now need to sign in
|
pass # code is correct and was used, now need to sign in
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user