Check for new code types in other phone number verifications.

This commit is contained in:
levlam 2022-09-07 21:22:21 +03:00
parent 9bd566702e
commit 20767a318b
3 changed files with 11 additions and 4 deletions

View File

@ -213,6 +213,14 @@ void PhoneNumberManager::on_send_code_result(NetQueryPtr &result) {
LOG(INFO) << "Receive " << to_string(sent_code);
switch (sent_code->type_->get_id()) {
case telegram_api::auth_sentCodeTypeSetUpEmailRequired::ID:
case telegram_api::auth_sentCodeTypeEmailCode::ID:
return on_query_error(Status::Error(500, "Receive incorrect response"));
default:
break;
}
send_code_helper_.on_sent_code(std::move(sent_code));
state_ = State::WaitCode;

View File

@ -13,7 +13,7 @@ namespace td {
void SendCodeHelper::on_sent_code(telegram_api::object_ptr<telegram_api::auth_sentCode> sent_code) {
phone_code_hash_ = std::move(sent_code->phone_code_hash_);
sent_code_info_ = get_authentication_code_info(std::move(sent_code->type_));
sent_code_info_ = get_sent_authentication_code_info(std::move(sent_code->type_));
next_code_info_ = get_authentication_code_info(std::move(sent_code->next_type_));
next_code_timestamp_ = Timestamp::in((sent_code->flags_ & SENT_CODE_FLAG_HAS_TIMEOUT) != 0 ? sent_code->timeout_ : 0);
}
@ -124,7 +124,7 @@ SendCodeHelper::AuthenticationCodeInfo SendCodeHelper::get_authentication_code_i
}
}
SendCodeHelper::AuthenticationCodeInfo SendCodeHelper::get_authentication_code_info(
SendCodeHelper::AuthenticationCodeInfo SendCodeHelper::get_sent_authentication_code_info(
tl_object_ptr<telegram_api::auth_SentCodeType> &&sent_code_type_ptr) {
CHECK(sent_code_type_ptr != nullptr);
switch (sent_code_type_ptr->get_id()) {
@ -151,7 +151,6 @@ SendCodeHelper::AuthenticationCodeInfo SendCodeHelper::get_authentication_code_i
}
case telegram_api::auth_sentCodeTypeEmailCode::ID:
case telegram_api::auth_sentCodeTypeSetUpEmailRequired::ID:
return AuthenticationCodeInfo();
default:
UNREACHABLE();
return AuthenticationCodeInfo();

View File

@ -87,7 +87,7 @@ class SendCodeHelper {
static AuthenticationCodeInfo get_authentication_code_info(
tl_object_ptr<telegram_api::auth_CodeType> &&code_type_ptr);
static AuthenticationCodeInfo get_authentication_code_info(
static AuthenticationCodeInfo get_sent_authentication_code_info(
tl_object_ptr<telegram_api::auth_SentCodeType> &&sent_code_type_ptr);
static td_api::object_ptr<td_api::AuthenticationCodeType> get_authentication_code_type_object(