From ebf9f45eeb9845b92b6f5a45ff36a9ea5994a336 Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 2 Sep 2019 18:11:47 +0300 Subject: [PATCH] Really fix Verify and Confirm for phone number. GitOrigin-RevId: 1f859c039bdf5a554efa4d328848fafa36c659d4 --- td/telegram/PhoneNumberManager.cpp | 5 +++-- td/telegram/SendCodeHelper.cpp | 10 +++++----- td/telegram/SendCodeHelper.h | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/td/telegram/PhoneNumberManager.cpp b/td/telegram/PhoneNumberManager.cpp index 9908faf8b..7fe63b9e1 100644 --- a/td/telegram/PhoneNumberManager.cpp +++ b/td/telegram/PhoneNumberManager.cpp @@ -56,7 +56,7 @@ void PhoneNumberManager::set_phone_number(uint64 query_id, string phone_number, case Type::ChangePhone: return process_send_code_result(query_id, send_code_helper_.send_change_phone_code(phone_number, settings)); case Type::VerifyPhone: - return process_send_code_result(query_id, send_code_helper_.send_confirm_phone_code(phone_number, settings)); + return process_send_code_result(query_id, send_code_helper_.send_verify_phone_code(phone_number, settings)); case Type::ConfirmPhone: default: UNREACHABLE(); @@ -74,7 +74,8 @@ void PhoneNumberManager::set_phone_number_and_hash(uint64 query_id, string hash, switch (type_) { case Type::ConfirmPhone: - return process_send_code_result(query_id, send_code_helper_.send_verify_phone_code(hash, phone_number, settings)); + return process_send_code_result(query_id, + send_code_helper_.send_confirm_phone_code(hash, phone_number, settings)); case Type::ChangePhone: case Type::VerifyPhone: default: diff --git a/td/telegram/SendCodeHelper.cpp b/td/telegram/SendCodeHelper.cpp index 92d9b10c1..9721aeed8 100644 --- a/td/telegram/SendCodeHelper.cpp +++ b/td/telegram/SendCodeHelper.cpp @@ -71,17 +71,17 @@ Result SendCodeHelper::send_change_ph return telegram_api::account_sendChangePhoneCode(phone_number_, get_input_code_settings(settings)); } -Result SendCodeHelper::send_verify_phone_code(const string &hash, - Slice phone_number, +Result SendCodeHelper::send_verify_phone_code(Slice phone_number, const Settings &settings) { phone_number_ = phone_number.str(); - return telegram_api::account_sendVerifyPhoneCode(hash, get_input_code_settings(settings)); + return telegram_api::account_sendVerifyPhoneCode(phone_number_, get_input_code_settings(settings)); } -Result SendCodeHelper::send_confirm_phone_code(Slice phone_number, +Result SendCodeHelper::send_confirm_phone_code(const string &hash, + Slice phone_number, const Settings &settings) { phone_number_ = phone_number.str(); - return telegram_api::account_sendConfirmPhoneCode(phone_number_, get_input_code_settings(settings)); + return telegram_api::account_sendConfirmPhoneCode(hash, get_input_code_settings(settings)); } SendCodeHelper::AuthenticationCodeInfo SendCodeHelper::get_authentication_code_info( diff --git a/td/telegram/SendCodeHelper.h b/td/telegram/SendCodeHelper.h index 54b3659dc..247c1b48d 100644 --- a/td/telegram/SendCodeHelper.h +++ b/td/telegram/SendCodeHelper.h @@ -31,10 +31,10 @@ class SendCodeHelper { Result send_change_phone_code(Slice phone_number, const Settings &settings); - Result send_verify_phone_code(const string &hash, Slice phone_number, + Result send_verify_phone_code(Slice phone_number, const Settings &settings); - Result send_confirm_phone_code(Slice phone_number, + Result send_confirm_phone_code(const string &hash, Slice phone_number, const Settings &settings); Slice phone_number() const {