mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-06 13:10:22 +03:00
Update telegram_client.py
This commit is contained in:
parent
e96327edae
commit
624b18d032
|
@ -38,7 +38,7 @@ from .errors import (
|
||||||
RPCError, UnauthorizedError, PhoneCodeEmptyError, PhoneCodeExpiredError,
|
RPCError, UnauthorizedError, PhoneCodeEmptyError, PhoneCodeExpiredError,
|
||||||
PhoneCodeHashEmptyError, PhoneCodeInvalidError, LocationInvalidError,
|
PhoneCodeHashEmptyError, PhoneCodeInvalidError, LocationInvalidError,
|
||||||
SessionPasswordNeededError, FileMigrateError, PhoneNumberUnoccupiedError,
|
SessionPasswordNeededError, FileMigrateError, PhoneNumberUnoccupiedError,
|
||||||
PhoneNumberOccupiedError, EmailUnconfirmedError
|
PhoneNumberOccupiedError, EmailUnconfirmedError, PasswordEmptyError
|
||||||
)
|
)
|
||||||
from .network import ConnectionMode
|
from .network import ConnectionMode
|
||||||
from .tl.custom import Draft, Dialog
|
from .tl.custom import Draft, Dialog
|
||||||
|
@ -2471,7 +2471,7 @@ class TelegramClient(TelegramBareClient):
|
||||||
'Make sure you have encountered this peer before.'.format(peer)
|
'Make sure you have encountered this peer before.'.format(peer)
|
||||||
)
|
)
|
||||||
|
|
||||||
def edit_2FA(self, current_password=None, new_password=None, hint='', email=None):
|
def edit_2fa(self, current_password=None, new_password=None, hint='', email=None):
|
||||||
"""
|
"""
|
||||||
Changes the 2FA settings of the logged in user, according to the
|
Changes the 2FA settings of the logged in user, according to the
|
||||||
passed parameters. Take note of the parameter explanations
|
passed parameters. Take note of the parameter explanations
|
||||||
|
@ -2500,15 +2500,15 @@ class TelegramClient(TelegramBareClient):
|
||||||
``True`` if successful, ``False`` otherwise
|
``True`` if successful, ``False`` otherwise
|
||||||
"""
|
"""
|
||||||
if new_password is None and current_password is None:
|
if new_password is None and current_password is None:
|
||||||
__log__.warn('Both new_password and current_password were not '\
|
raise PasswordEmptyError('Both new_password and current_password '\
|
||||||
'specified, nothing to do')
|
'were not specified')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
pass_result = self(GetPasswordRequest())
|
pass_result = self(GetPasswordRequest())
|
||||||
if isinstance(pass_result, NoPassword) and current_password:
|
if isinstance(pass_result, NoPassword) and current_password:
|
||||||
__log__.warn('You supplied current_password even though this '\
|
__log__.warn('You supplied current_password even though this '\
|
||||||
'account does not have one set')
|
'account does not have one set')
|
||||||
return False # can do "current_password = None" and continue too
|
current_password = None
|
||||||
salt_random = os.urandom(8)
|
salt_random = os.urandom(8)
|
||||||
salt = pass_result.new_salt + salt_random
|
salt = pass_result.new_salt + salt_random
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user