From a46d8a9ee4cdcbf75aef4c508d9f03e5e4661dc1 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 31 Jan 2023 14:09:52 +0300 Subject: fixes #3317 completely --- protocols/Telegram/src/auth.cpp | 19 +++++++++++++++++++ protocols/Telegram/src/proto.h | 1 + 2 files changed, 20 insertions(+) (limited to 'protocols') diff --git a/protocols/Telegram/src/auth.cpp b/protocols/Telegram/src/auth.cpp index f992704e92..cdb1df9aeb 100644 --- a/protocols/Telegram/src/auth.cpp +++ b/protocols/Telegram/src/auth.cpp @@ -28,6 +28,21 @@ INT_PTR CALLBACK CTelegramProto::EnterEmail(void *param) ENTER_STRING es = {}; es.szModuleName = ppro->m_szModuleName; es.caption = TranslateT("Enter email address for account verification"); + if (EnterString(&es)) { + ppro->SendQuery(new TD::setAuthenticationEmailAddress(T2Utf(es.ptszResult).get()), &CTelegramProto::OnUpdateAuth); + mir_free(es.ptszResult); + } + else ppro->LogOut(); + return 0; +} + +INT_PTR CALLBACK CTelegramProto::EnterEmailCode(void *param) +{ + auto *ppro = (CTelegramProto *)param; + + ENTER_STRING es = {}; + es.szModuleName = ppro->m_szModuleName; + es.caption = TranslateT("Enter verification code received by email"); if (EnterString(&es)) { ppro->SendQuery(new TD::checkEmailAddressVerificationCode(T2Utf(es.ptszResult).get()), &CTelegramProto::OnUpdateAuth); mir_free(es.ptszResult); @@ -115,6 +130,10 @@ void CTelegramProto::ProcessAuth(TD::updateAuthorizationState *pObj) CallFunctionSync(EnterEmail, this); break; + case TD::authorizationStateWaitEmailCode::ID: + CallFunctionSync(EnterEmailCode, this); + break; + case TD::authorizationStateReady::ID: OnLoggedIn(); break; diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h index ba643520e5..0b7fdd5779 100644 --- a/protocols/Telegram/src/proto.h +++ b/protocols/Telegram/src/proto.h @@ -134,6 +134,7 @@ class CTelegramProto : public PROTO OBJLIST m_arFiles; static INT_PTR CALLBACK EnterEmail(void *param); + static INT_PTR CALLBACK EnterEmailCode(void *param); static INT_PTR CALLBACK EnterPassword(void *param); static INT_PTR CALLBACK EnterPhoneCode(void *param); -- cgit v1.2.3