Auto log in if password was removed just after code checking.
GitOrigin-RevId: f01d53b5d93ec20690a4099d8be1d60d6b9ca3c1
This commit is contained in:
parent
4404267ec4
commit
8283d04942
@ -584,6 +584,7 @@ void AuthManager::check_code(uint64 query_id, string code, string first_name, st
|
|||||||
return on_query_error(query_id, Status::Error(8, "checkAuthenticationCode unexpected"));
|
return on_query_error(query_id, Status::Error(8, "checkAuthenticationCode unexpected"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
code_ = code;
|
||||||
on_new_query(query_id);
|
on_new_query(query_id);
|
||||||
if (send_code_helper_.phone_registered() || first_name.empty()) {
|
if (send_code_helper_.phone_registered() || first_name.empty()) {
|
||||||
start_net_query(NetQueryType::SignIn,
|
start_net_query(NetQueryType::SignIn,
|
||||||
@ -748,13 +749,13 @@ void AuthManager::on_get_password_result(NetQueryPtr &result) {
|
|||||||
return on_query_error(r_password.move_as_error());
|
return on_query_error(r_password.move_as_error());
|
||||||
}
|
}
|
||||||
auto password = r_password.move_as_ok();
|
auto password = r_password.move_as_ok();
|
||||||
|
LOG(INFO) << "Receive password info: " << to_string(password);
|
||||||
|
|
||||||
wait_password_state_ = WaitPasswordState();
|
wait_password_state_ = WaitPasswordState();
|
||||||
if (password->current_algo_ != nullptr) {
|
if (password->current_algo_ != nullptr) {
|
||||||
switch (password->current_algo_->get_id()) {
|
switch (password->current_algo_->get_id()) {
|
||||||
case telegram_api::passwordKdfAlgoUnknown::ID:
|
case telegram_api::passwordKdfAlgoUnknown::ID:
|
||||||
// TODO we need to abort authorization somehow
|
return on_query_error(Status::Error(400, "Application update is needed to log in"));
|
||||||
break;
|
|
||||||
case telegram_api::passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow::ID: {
|
case telegram_api::passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow::ID: {
|
||||||
auto algo = move_tl_object_as<telegram_api::passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow>(
|
auto algo = move_tl_object_as<telegram_api::passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow>(
|
||||||
password->current_algo_);
|
password->current_algo_);
|
||||||
@ -773,7 +774,12 @@ void AuthManager::on_get_password_result(NetQueryPtr &result) {
|
|||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO we need to resend auth_signIn instead of going to WaitPassword state
|
start_net_query(NetQueryType::SignIn,
|
||||||
|
G()->net_query_creator().create(
|
||||||
|
create_storer(telegram_api::auth_signIn(send_code_helper_.phone_number().str(),
|
||||||
|
send_code_helper_.phone_code_hash().str(), code_)),
|
||||||
|
DcId::main(), NetQuery::Type::Common, NetQuery::AuthFlag::Off));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
update_state(State::WaitPassword);
|
update_state(State::WaitPassword);
|
||||||
|
@ -265,6 +265,7 @@ class AuthManager : public NetActor {
|
|||||||
|
|
||||||
// State::WaitCode
|
// State::WaitCode
|
||||||
SendCodeHelper send_code_helper_;
|
SendCodeHelper send_code_helper_;
|
||||||
|
string code_;
|
||||||
TermsOfService terms_of_service_;
|
TermsOfService terms_of_service_;
|
||||||
|
|
||||||
// for bots
|
// for bots
|
||||||
|
@ -6482,6 +6482,7 @@ void ContactsManager::on_get_chats(vector<tl_object_ptr<telegram_api::Chat>> &&c
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ContactsManager::on_get_chat_full(tl_object_ptr<telegram_api::ChatFull> &&chat_full_ptr) {
|
void ContactsManager::on_get_chat_full(tl_object_ptr<telegram_api::ChatFull> &&chat_full_ptr) {
|
||||||
|
LOG(INFO) << "Receive " << to_string(chat_full_ptr);
|
||||||
if (chat_full_ptr->get_id() == telegram_api::chatFull::ID) {
|
if (chat_full_ptr->get_id() == telegram_api::chatFull::ID) {
|
||||||
auto chat_full = move_tl_object_as<telegram_api::chatFull>(chat_full_ptr);
|
auto chat_full = move_tl_object_as<telegram_api::chatFull>(chat_full_ptr);
|
||||||
ChatId chat_id(chat_full->id_);
|
ChatId chat_id(chat_full->id_);
|
||||||
|
Loading…
Reference in New Issue
Block a user