mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-26 11:23:46 +03:00
Fix is_user_authorized after log_out
This commit is contained in:
parent
6e77f583f1
commit
e677a6bb05
|
@ -291,7 +291,6 @@ class AuthMethods(MessageParseMethods, UserMethods):
|
|||
self._self_input_peer = utils.get_input_peer(
|
||||
result.user, allow_self=False
|
||||
)
|
||||
self._authorized = True
|
||||
return result.user
|
||||
|
||||
async def sign_up(self, code, first_name, last_name=''):
|
||||
|
@ -344,7 +343,6 @@ class AuthMethods(MessageParseMethods, UserMethods):
|
|||
self._self_input_peer = utils.get_input_peer(
|
||||
result.user, allow_self=False
|
||||
)
|
||||
self._authorized = True
|
||||
return result.user
|
||||
|
||||
async def send_code_request(self, phone, *, force_sms=False):
|
||||
|
@ -398,9 +396,10 @@ class AuthMethods(MessageParseMethods, UserMethods):
|
|||
except errors.RPCError:
|
||||
return False
|
||||
|
||||
self._self_input_peer = None
|
||||
self._state.pts = -1
|
||||
await self.disconnect()
|
||||
await self.session.delete()
|
||||
self._authorized = False
|
||||
return True
|
||||
|
||||
async def edit_2fa(
|
||||
|
|
|
@ -246,9 +246,6 @@ class TelegramBaseClient(abc.ABC):
|
|||
self._borrowed_senders = {}
|
||||
self._borrow_sender_lock = asyncio.Lock(loop=self._loop)
|
||||
|
||||
# Save whether the user is authorized here (a.k.a. logged in)
|
||||
self._authorized = None # None = We don't know yet
|
||||
|
||||
self._updates_handle = None
|
||||
self._last_request = time.time()
|
||||
self._channel_pts = {}
|
||||
|
@ -380,7 +377,6 @@ class TelegramBaseClient(abc.ABC):
|
|||
Callback from the sender whenever it needed to generate a
|
||||
new authorization key. This means we are not authorized.
|
||||
"""
|
||||
self._authorized = None
|
||||
self.session.auth_key = auth_key
|
||||
await self.session.save()
|
||||
|
||||
|
@ -487,7 +483,6 @@ class TelegramBaseClient(abc.ABC):
|
|||
# when needed by ._get_dc, and also it's static so it's likely
|
||||
# set already. Avoid invoking non-CDN methods by not syncing updates.
|
||||
client.connect(_sync_updates=False)
|
||||
client._authorized = self._authorized
|
||||
return client
|
||||
|
||||
# endregion
|
||||
|
|
Loading…
Reference in New Issue
Block a user