From 09aa775fe72185709d2d5d1e2bbc74bad2da3ae2 Mon Sep 17 00:00:00 2001 From: levlam Date: Sun, 28 Jul 2019 21:17:47 +0300 Subject: [PATCH] Allow to call CheckAuthenticationBotToken multiple times. GitOrigin-RevId: ee1f6bd74f0e7d573afade705b47102aa51e5317 --- td/telegram/AuthManager.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/td/telegram/AuthManager.cpp b/td/telegram/AuthManager.cpp index 6289c53a..6f9a6b99 100644 --- a/td/telegram/AuthManager.cpp +++ b/td/telegram/AuthManager.cpp @@ -137,6 +137,10 @@ void AuthManager::get_state(uint64 query_id) { } void AuthManager::check_bot_token(uint64 query_id, string bot_token) { + if (state_ == State::WaitPhoneNumber && net_query_id_ == 0) { + // can ignore previous checks + was_check_bot_token_ = false; // TODO can we remove was_check_bot_token_ after State::Ok is disallowed? + } if (state_ != State::WaitPhoneNumber && state_ != State::Ok) { // TODO do not allow State::Ok return on_query_error(query_id, Status::Error(8, "checkAuthenticationBotToken unexpected"));