Return PasswordState from confirming recovery email address methods.
GitOrigin-RevId: 0f897eeac6b09dd6edcfe1237226e7df7116a175
This commit is contained in:
parent
ffd7b166d9
commit
f3be5d6534
@ -2621,10 +2621,10 @@ getRecoveryEmailAddress password:string = RecoveryEmailAddress;
|
||||
setRecoveryEmailAddress password:string new_recovery_email_address:string = PasswordState;
|
||||
|
||||
//@description Checks the 2-step verification recovery email address verification code @code Verification code
|
||||
checkRecoveryEmailAddressCode code:string = Ok;
|
||||
checkRecoveryEmailAddressCode code:string = PasswordState;
|
||||
|
||||
//@description Resends the 2-step verification recovery email address verification code
|
||||
resendRecoveryEmailAddressCode = Ok;
|
||||
resendRecoveryEmailAddressCode = PasswordState;
|
||||
|
||||
//@description Requests to send a password recovery code to an email address that was previously set up
|
||||
requestPasswordRecovery = EmailAddressAuthenticationCodeInfo;
|
||||
|
Binary file not shown.
@ -381,28 +381,29 @@ void PasswordManager::get_recovery_email_address(string password,
|
||||
}));
|
||||
}
|
||||
|
||||
void PasswordManager::check_recovery_email_address_code(string code, Promise<Unit> promise) {
|
||||
void PasswordManager::check_recovery_email_address_code(string code, Promise<State> promise) {
|
||||
auto query =
|
||||
G()->net_query_creator().create(create_storer(telegram_api::account_confirmPasswordEmail(std::move(code))));
|
||||
send_with_promise(std::move(query),
|
||||
PromiseCreator::lambda([promise = std::move(promise)](Result<NetQueryPtr> r_query) mutable {
|
||||
send_with_promise(std::move(query), PromiseCreator::lambda([actor_id = actor_id(this), promise = std::move(promise)](
|
||||
Result<NetQueryPtr> r_query) mutable {
|
||||
auto r_result = fetch_result<telegram_api::account_confirmPasswordEmail>(std::move(r_query));
|
||||
if (r_result.is_error()) {
|
||||
if (r_result.is_error() && r_result.error().message() != "EMAIL_HASH_EXPIRED" &&
|
||||
r_result.error().message() != "CODE_INVALID") {
|
||||
return promise.set_error(r_result.move_as_error());
|
||||
}
|
||||
return promise.set_value(Unit());
|
||||
send_closure(actor_id, &PasswordManager::get_state, std::move(promise));
|
||||
}));
|
||||
}
|
||||
|
||||
void PasswordManager::resend_recovery_email_address_code(Promise<Unit> promise) {
|
||||
void PasswordManager::resend_recovery_email_address_code(Promise<State> 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<NetQueryPtr> r_query) mutable {
|
||||
send_with_promise(std::move(query), PromiseCreator::lambda([actor_id = actor_id(this), promise = std::move(promise)](
|
||||
Result<NetQueryPtr> r_query) mutable {
|
||||
auto r_result = fetch_result<telegram_api::account_resendPasswordEmail>(std::move(r_query));
|
||||
if (r_result.is_error()) {
|
||||
if (r_result.is_error() && r_result.error().message() != "EMAIL_HASH_EXPIRED") {
|
||||
return promise.set_error(r_result.move_as_error());
|
||||
}
|
||||
return promise.set_value(Unit());
|
||||
send_closure(actor_id, &PasswordManager::get_state, std::move(promise));
|
||||
}));
|
||||
}
|
||||
|
||||
@ -443,7 +444,7 @@ void PasswordManager::check_email_address_verification_code(string code, Promise
|
||||
create_storer(telegram_api::account_verifyEmail(last_verified_email_address_, std::move(code))));
|
||||
send_with_promise(std::move(query),
|
||||
PromiseCreator::lambda([promise = std::move(promise)](Result<NetQueryPtr> r_query) mutable {
|
||||
auto r_result = fetch_result<telegram_api::account_updatePasswordSettings>(std::move(r_query));
|
||||
auto r_result = fetch_result<telegram_api::account_verifyEmail>(std::move(r_query));
|
||||
if (r_result.is_error()) {
|
||||
return promise.set_error(r_result.move_as_error());
|
||||
}
|
||||
|
@ -66,8 +66,8 @@ class PasswordManager : public NetQueryCallback {
|
||||
string recovery_email_address, Promise<State> promise);
|
||||
void set_recovery_email_address(string password, string new_recovery_email_address, Promise<State> promise);
|
||||
void get_recovery_email_address(string password, Promise<tl_object_ptr<td_api::recoveryEmailAddress>> promise);
|
||||
void check_recovery_email_address_code(string code, Promise<Unit> promise);
|
||||
void resend_recovery_email_address_code(Promise<Unit> promise);
|
||||
void check_recovery_email_address_code(string code, Promise<State> promise);
|
||||
void resend_recovery_email_address_code(Promise<State> promise);
|
||||
|
||||
void send_email_address_verification_code(
|
||||
string email, Promise<td_api::object_ptr<td_api::emailAddressAuthenticationCodeInfo>> promise);
|
||||
|
@ -4709,14 +4709,14 @@ void Td::on_request(uint64 id, td_api::getRecoveryEmailAddress &request) {
|
||||
void Td::on_request(uint64 id, td_api::checkRecoveryEmailAddressCode &request) {
|
||||
CHECK_IS_USER();
|
||||
CLEAN_INPUT_STRING(request.code_);
|
||||
CREATE_OK_REQUEST_PROMISE();
|
||||
CREATE_REQUEST_PROMISE();
|
||||
send_closure(password_manager_, &PasswordManager::check_recovery_email_address_code, request.code_,
|
||||
std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, const td_api::resendRecoveryEmailAddressCode &request) {
|
||||
CHECK_IS_USER();
|
||||
CREATE_OK_REQUEST_PROMISE();
|
||||
CREATE_REQUEST_PROMISE();
|
||||
send_closure(password_manager_, &PasswordManager::resend_recovery_email_address_code, std::move(promise));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user