diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c120d4d..5f112cea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -394,5 +394,5 @@ tell about madeline.php loading in the same dire remind about using the define -fix trimming newlines in beginning -weird splitting mmm ``` \ No newline at end of file +Handle auth_restart +splitting diff --git a/README.md b/README.md index 86c80b51..57c2af44 100644 --- a/README.md +++ b/README.md @@ -64,14 +64,16 @@ Tip: if you receive an error (or nothing), [send us](https://t.me/pwrtelegramgro * [Async in event handler](https://docs.madelineproto.xyz/docs/ASYNC.html#async-in-event-handler) * [Async in callback handler](https://docs.madelineproto.xyz/docs/ASYNC.html#async-in-callback-handler) * [Wrapped async](https://docs.madelineproto.xyz/docs/ASYNC.html#wrapped-async) + * [Multiple async](https://docs.madelineproto.xyz/docs/ASYNC.html#multiple-async) * [Ignored async](https://docs.madelineproto.xyz/docs/ASYNC.html#ignored-async) * [Blocking async](https://docs.madelineproto.xyz/docs/ASYNC.html#blocking-async) * [MadelineProto and AMPHP async APIs](https://docs.madelineproto.xyz/docs/ASYNC.html#madelineproto-and-amphp-async-apis) * [Helper methods](https://docs.madelineproto.xyz/docs/ASYNC.html#helper-methods) * [Async sleep](https://docs.madelineproto.xyz/docs/ASYNC.html#async-sleep-does-not-block-the-main-thread) * [Async readline](https://docs.madelineproto.xyz/docs/ASYNC.html#async-readline-does-not-block-the-main-thread) + * [Async echo](https://docs.madelineproto.xyz/docs/ASYNC.html#async-echo-does-not-block-the-main-thread) * [MadelineProto artax HTTP client](https://docs.madelineproto.xyz/docs/ASYNC.html#madelineproto-artax-http-client) - * [Async forking](https://docs.madelineproto.xyz/docs/ASYNC.html#async-forking-does-single-thread-forking) + * [Async forking](https://docs.madelineproto.xyz/docs/ASYNC.html#async-forking-does-green-thread-forking) * [Combining async operations](https://docs.madelineproto.xyz/docs/ASYNC.html#combining-async-operations) * [MadelineProto async loop APIs](https://docs.madelineproto.xyz/docs/ASYNC.html#async-loop-apis) * [Loop](https://docs.madelineproto.xyz/docs/ASYNC.html#loop) @@ -437,6 +439,7 @@ Tip: if you receive an error (or nothing), [send us](https://t.me/pwrtelegramgro * [bot API objects](https://docs.madelineproto.xyz/docs/USING_METHODS.html#bot-api-objects) * [No result](https://docs.madelineproto.xyz/docs/USING_METHODS.html#no-result) * [Queues](https://docs.madelineproto.xyz/docs/USING_METHODS.html#queues) + * [Multiple method calls](https://docs.madelineproto.xyz/docs/USING_METHODS.html#multiple-method-calls) * [Contributing](https://docs.madelineproto.xyz/docs/CONTRIB.html) * [Translation](https://docs.madelineproto.xyz/docs/CONTRIB.html#translation) * [Contribution guide](https://docs.madelineproto.xyz/docs/CONTRIB.html#contribution-guide) diff --git a/src/danog/MadelineProto/MTProtoTools/PasswordCalculator.php b/src/danog/MadelineProto/MTProtoTools/PasswordCalculator.php index 2120b037..972ef4ec 100644 --- a/src/danog/MadelineProto/MTProtoTools/PasswordCalculator.php +++ b/src/danog/MadelineProto/MTProtoTools/PasswordCalculator.php @@ -39,6 +39,9 @@ class PasswordCalculator private $srp_BForHash; private $srp_id; + // This is needed do not remove this + public function __construct($logger) { $this->logger = $logger; } + public function addInfo(array $object) { if ($object['_'] !== 'account.password') { diff --git a/src/danog/MadelineProto/Wrappers/Login.php b/src/danog/MadelineProto/Wrappers/Login.php index cbfa4b22..2b15c5cc 100644 --- a/src/danog/MadelineProto/Wrappers/Login.php +++ b/src/danog/MadelineProto/Wrappers/Login.php @@ -199,7 +199,7 @@ trait Login throw new \danog\MadelineProto\Exception(\danog\MadelineProto\Lang::$current_lang['2fa_uncalled']); } $this->authorized = self::NOT_LOGGED_IN; - $hasher = new PasswordCalculator(); + $hasher = new PasswordCalculator($this->logger); $hasher->addInfo($this->authorization); $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['login_user'], \danog\MadelineProto\Logger::NOTICE); $this->authorization = yield $this->method_call_async_read('auth.checkPassword', ['password' => $hasher->getCheckPassword($password)], ['datacenter' => $this->datacenter->curdc]); @@ -223,7 +223,7 @@ trait Login */ public function update_2fa_async(array $params) { - $hasher = new PasswordCalculator(); + $hasher = new PasswordCalculator($this->logger); $hasher->addInfo(yield $this->method_call_async_read('account.getPassword', [], ['datacenter' => $this->datacenter->curdc])); return yield $this->method_call_async_read('account.updatePasswordSettings', $hasher->getPassword($params), ['datacenter' => $this->datacenter->curdc]);