Allow to call CheckAuthenticationBotToken multiple times.

GitOrigin-RevId: ee1f6bd74f0e7d573afade705b47102aa51e5317
This commit is contained in:
levlam 2019-07-28 21:17:47 +03:00
parent 17b1222a9a
commit 09aa775fe7

View File

@ -137,6 +137,10 @@ void AuthManager::get_state(uint64 query_id) {
} }
void AuthManager::check_bot_token(uint64 query_id, string bot_token) { 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) { if (state_ != State::WaitPhoneNumber && state_ != State::Ok) {
// TODO do not allow State::Ok // TODO do not allow State::Ok
return on_query_error(query_id, Status::Error(8, "checkAuthenticationBotToken unexpected")); return on_query_error(query_id, Status::Error(8, "checkAuthenticationBotToken unexpected"));