Add td_api::reportAuthenticationCodeMissing.

This commit is contained in:
levlam 2024-04-22 18:39:16 +03:00
parent 4706fb3081
commit 440176cd3c
8 changed files with 29 additions and 0 deletions

View File

@ -7456,6 +7456,9 @@ recoverAuthenticationPassword recovery_code:string new_password:string new_hint:
//@token SafetyNet Attestation API token for the Android application, or secret from push notification for the iOS application
sendAuthenticationFirebaseSms token:string = Ok;
//@description Reports that authentication code wasn't delivered via SMS; for official mobile apps only. Works only when the current authorization state is authorizationStateWaitCode @mobile_network_code Current mobile network code
reportAuthenticationCodeMissing mobile_network_code:string = Ok;
//@description Checks the authentication token of a bot; to log in as a bot. Works only when the current authorization state is authorizationStateWaitPhoneNumber. Can be used instead of setAuthenticationPhoneNumber and checkAuthenticationCode to log in @token The bot token
checkAuthenticationBotToken token:string = Ok;

View File

@ -539,6 +539,15 @@ void AuthManager::set_firebase_token(uint64 query_id, string token) {
G()->net_query_creator().create_unauth(send_code_helper_.request_firebase_sms(token)));
}
void AuthManager::report_missing_code(uint64 query_id, string mobile_network_code) {
if (state_ != State::WaitCode) {
return on_query_error(query_id, Status::Error(400, "Call to reportAuthenticationCodeMissing unexpected"));
}
G()->net_query_dispatcher().dispatch_with_callback(
G()->net_query_creator().create_unauth(send_code_helper_.report_missing_code(mobile_network_code)),
actor_shared(this));
}
void AuthManager::set_email_address(uint64 query_id, string email_address) {
if (state_ != State::WaitEmailAddress) {
if (state_ == State::WaitEmailCode && net_query_id_ == 0) {

View File

@ -39,6 +39,7 @@ class AuthManager final : public NetActor {
void set_phone_number(uint64 query_id, string phone_number,
td_api::object_ptr<td_api::phoneNumberAuthenticationSettings> settings);
void set_firebase_token(uint64 query_id, string token);
void report_missing_code(uint64 query_id, string mobile_network_code);
void set_email_address(uint64 query_id, string email_address);
void resend_authentication_code(uint64 query_id);
void check_email_code(uint64 query_id, EmailVerification &&code);

View File

@ -119,6 +119,10 @@ telegram_api::auth_requestFirebaseSms SendCodeHelper::request_firebase_sms(const
ios_push_secret);
}
telegram_api::auth_reportMissingCode SendCodeHelper::report_missing_code(const string &mobile_network_code) {
return telegram_api::auth_reportMissingCode(phone_number_, phone_code_hash_, mobile_network_code);
}
telegram_api::account_sendVerifyEmailCode SendCodeHelper::send_verify_email_code(const string &email_address) {
return telegram_api::account_sendVerifyEmailCode(get_email_verify_purpose_login_setup(), email_address);
}

View File

@ -34,6 +34,8 @@ class SendCodeHelper {
telegram_api::auth_requestFirebaseSms request_firebase_sms(const string &token);
telegram_api::auth_reportMissingCode report_missing_code(const string &mobile_network_code);
telegram_api::account_sendVerifyEmailCode send_verify_email_code(const string &email_address);
telegram_api::account_sendChangePhoneCode send_change_phone_code(Slice phone_number, const Settings &settings);

View File

@ -2762,6 +2762,7 @@ bool Td::is_authentication_request(int32 id) {
case td_api::getAuthorizationState::ID:
case td_api::setAuthenticationPhoneNumber::ID:
case td_api::sendAuthenticationFirebaseSms::ID:
case td_api::reportAuthenticationCodeMissing::ID:
case td_api::setAuthenticationEmailAddress::ID:
case td_api::resendAuthenticationCode::ID:
case td_api::checkAuthenticationEmailCode::ID:
@ -4236,6 +4237,11 @@ void Td::on_request(uint64 id, td_api::sendAuthenticationFirebaseSms &request) {
send_closure(auth_manager_actor_, &AuthManager::set_firebase_token, id, std::move(request.token_));
}
void Td::on_request(uint64 id, td_api::reportAuthenticationCodeMissing &request) {
CLEAN_INPUT_STRING(request.mobile_network_code_);
send_closure(auth_manager_actor_, &AuthManager::report_missing_code, id, std::move(request.mobile_network_code_));
}
void Td::on_request(uint64 id, td_api::setAuthenticationEmailAddress &request) {
CLEAN_INPUT_STRING(request.email_address_);
send_closure(auth_manager_actor_, &AuthManager::set_email_address, id, std::move(request.email_address_));

View File

@ -479,6 +479,8 @@ class Td final : public Actor {
void on_request(uint64 id, td_api::sendAuthenticationFirebaseSms &request);
void on_request(uint64 id, td_api::reportAuthenticationCodeMissing &request);
void on_request(uint64 id, td_api::setAuthenticationEmailAddress &request);
void on_request(uint64 id, const td_api::resendAuthenticationCode &request);

View File

@ -2444,6 +2444,8 @@ class CliClient final : public Actor {
send_request(td_api::make_object<td_api::checkAuthenticationEmailCode>(as_email_address_authentication(args)));
} else if (op == "cac") {
send_request(td_api::make_object<td_api::checkAuthenticationCode>(args));
} else if (op == "racmg") {
send_request(td_api::make_object<td_api::reportAuthenticationCodeMissing>(args));
} else if (op == "ru" || op == "rus") {
string first_name;
string last_name;