diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index caf1b83aa..eaa7cbe1a 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -4640,7 +4640,7 @@ setAuthenticationPhoneNumber phone_number:string settings:phoneNumberAuthenticat //@description Sets the email address of the user and sends an authentication code to the email address. Works only when the current authorization state is authorizationStateWaitEmailAddress @email_address The email address of the user setAuthenticationEmailAddress email_address:string = Ok; -//@description Resends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitCode, the next_code_type of the result is not null and the server-specified timeout has passed +//@description Resends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitCode, the next_code_type of the result is not null and the server-specified timeout has passed, or when the current authorization state is authorizationStateWaitEmailCode resendAuthenticationCode = Ok; //@description Checks the authentication of a email address. Works only when the current authorization state is authorizationStateWaitEmailCode @code Email address authentication to check diff --git a/td/telegram/AuthManager.cpp b/td/telegram/AuthManager.cpp index 5ae368af3..1a80475af 100644 --- a/td/telegram/AuthManager.cpp +++ b/td/telegram/AuthManager.cpp @@ -306,6 +306,13 @@ void AuthManager::set_email_address(uint64 query_id, string email_address) { void AuthManager::resend_authentication_code(uint64 query_id) { if (state_ != State::WaitCode) { + if (state_ == State::WaitEmailCode) { + on_new_query(query_id); + start_net_query(NetQueryType::SendEmailCode, + G()->net_query_creator().create_unauth(send_code_helper_.send_verify_email_code(email_address_))); + return; + } + return on_query_error(query_id, Status::Error(400, "Call to resendAuthenticationCode unexpected")); }