diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 78e0fa54..5fadf7a7 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -2598,9 +2598,12 @@ getRecoveryEmailAddress password:string = RecoveryEmailAddress; //-If new_recovery_email_address is the same as the email address that is currently set up, this call succeeds immediately and aborts all other requests waiting for an email confirmation @password Password of the current user @new_recovery_email_address New recovery email address setRecoveryEmailAddress password:string new_recovery_email_address:string = PasswordState; -//@description Checks the 2-step verification recovery email address code @code Verification code +//@description Checks the 2-step verification recovery email address verification code @code Verification code checkRecoveryEmailAddressCode code:string = Ok; +//@description Resends the 2-step verification recovery email address verification code +resendRecoveryEmailAddressCode = Ok; + //@description Requests to send a password recovery code to an email address that was previously set up requestPasswordRecovery = EmailAddressAuthenticationCodeInfo; diff --git a/td/generate/scheme/td_api.tlo b/td/generate/scheme/td_api.tlo index ac689d67..64b38341 100644 Binary files a/td/generate/scheme/td_api.tlo and b/td/generate/scheme/td_api.tlo differ diff --git a/td/telegram/PasswordManager.cpp b/td/telegram/PasswordManager.cpp index 51b260e4..adcc4d32 100644 --- a/td/telegram/PasswordManager.cpp +++ b/td/telegram/PasswordManager.cpp @@ -393,6 +393,19 @@ void PasswordManager::check_recovery_email_address_code(string code, Promise promise) { + auto query = + G()->net_query_creator().create(create_storer(telegram_api::account_resendPasswordEmail())); + send_with_promise(std::move(query), + PromiseCreator::lambda([promise = std::move(promise)](Result r_query) mutable { + auto r_result = fetch_result(std::move(r_query)); + if (r_result.is_error()) { + return promise.set_error(r_result.move_as_error()); + } + return promise.set_value(Unit()); + })); +} + void PasswordManager::send_email_address_verification_code( string email, Promise> promise) { last_verified_email_address_ = email; diff --git a/td/telegram/PasswordManager.h b/td/telegram/PasswordManager.h index 3facd25f..cffc6710 100644 --- a/td/telegram/PasswordManager.h +++ b/td/telegram/PasswordManager.h @@ -67,6 +67,7 @@ class PasswordManager : public NetQueryCallback { void set_recovery_email_address(string password, string new_recovery_email_address, Promise promise); void get_recovery_email_address(string password, Promise> promise); void check_recovery_email_address_code(string code, Promise promise); + void resend_recovery_email_address_code(Promise promise); void send_email_address_verification_code( string email, Promise> promise); diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index fb05f333..c5d7b87f 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -4658,6 +4658,12 @@ void Td::on_request(uint64 id, td_api::checkRecoveryEmailAddressCode &request) { std::move(promise)); } +void Td::on_request(uint64 id, const td_api::resendRecoveryEmailAddressCode &request) { + CHECK_IS_USER(); + CREATE_OK_REQUEST_PROMISE(); + send_closure(password_manager_, &PasswordManager::resend_recovery_email_address_code, std::move(promise)); +} + void Td::on_request(uint64 id, td_api::requestPasswordRecovery &request) { CHECK_IS_USER(); CREATE_REQUEST_PROMISE(); diff --git a/td/telegram/Td.h b/td/telegram/Td.h index 10259a45..29196b84 100644 --- a/td/telegram/Td.h +++ b/td/telegram/Td.h @@ -379,6 +379,8 @@ class Td final : public NetQueryCallback { void on_request(uint64 id, td_api::checkRecoveryEmailAddressCode &request); + void on_request(uint64 id, const td_api::resendRecoveryEmailAddressCode &request); + void on_request(uint64 id, td_api::requestPasswordRecovery &request); void on_request(uint64 id, td_api::recoverPassword &request); diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index bd30128f..c214598f 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -1364,6 +1364,8 @@ class CliClient final : public Actor { send_request(make_tl_object(args)); } else if (op == "creac") { send_request(make_tl_object(args)); + } else if (op == "rreac") { + send_request(make_tl_object()); } else if (op == "spncc") { send_request(make_tl_object(args, false, false)); } else if (op == "cpncc") {