Skip to content

Commit

Permalink
Don't try to check password without checkAuthenticationPassword/recov…
Browse files Browse the repository at this point in the history
…erAuthenticationPassword query.
  • Loading branch information
levlam committed Feb 4, 2023
1 parent 1724002 commit e9aa2fd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion td/telegram/AuthManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ void AuthManager::check_password(uint64 query_id, string password) {

LOG(INFO) << "Have SRP ID " << wait_password_state_.srp_id_;
on_new_query(query_id);
checking_password_ = true;
password_ = std::move(password);
recovery_code_.clear();
new_password_.clear();
Expand Down Expand Up @@ -438,6 +439,7 @@ void AuthManager::recover_password(uint64 query_id, string code, string new_pass
}

on_new_query(query_id);
checking_password_ = true;
if (!new_password.empty()) {
password_.clear();
recovery_code_ = std::move(code);
Expand Down Expand Up @@ -526,6 +528,7 @@ void AuthManager::on_new_query(uint64 query_id) {
if (query_id_ != 0) {
on_query_error(Status::Error(400, "Another authorization query has started"));
}
checking_password_ = false;
net_query_id_ = 0;
net_query_type_ = NetQueryType::None;
query_id_ = query_id;
Expand All @@ -538,6 +541,7 @@ void AuthManager::on_query_error(Status status) {
query_id_ = 0;
net_query_id_ = 0;
net_query_type_ = NetQueryType::None;
checking_password_ = false;
on_query_error(id, std::move(status));
}

Expand Down Expand Up @@ -777,7 +781,7 @@ void AuthManager::on_get_password_result(NetQueryPtr &result) {
imported_dc_id_ = -1;
}

if (state_ == State::WaitPassword) {
if (state_ == State::WaitPassword && checking_password_) {
if (!new_password_.empty()) {
if (r_new_password_state.is_error()) {
return on_query_error(r_new_password_state.move_as_error());
Expand Down
1 change: 1 addition & 0 deletions td/telegram/AuthManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ class AuthManager final : public NetActor {
int32 login_code_retry_delay_ = 0;
Timeout poll_export_login_code_timeout_;

bool checking_password_ = false;
bool was_qr_code_request_ = false;
bool was_check_bot_token_ = false;
bool is_bot_ = false;
Expand Down

0 comments on commit e9aa2fd

Please sign in to comment.