This commit is contained in:
Daniil Gentili 2019-06-06 00:33:11 +02:00
parent a4e25ecfa2
commit fd1234bfbd
4 changed files with 11 additions and 5 deletions

View File

@ -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 ```
Handle auth_restart
splitting

View File

@ -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)

View File

@ -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') {

View File

@ -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]);