Support resending of email authentication code.

This commit is contained in:
levlam 2022-09-07 19:42:21 +03:00
parent 1b7f24459f
commit ba547561bb
2 changed files with 8 additions and 1 deletions

View File

@ -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

View File

@ -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"));
}