diff options
author | George Hazan <ghazan@miranda.im> | 2023-01-31 14:09:52 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2023-01-31 14:09:52 +0300 |
commit | a46d8a9ee4cdcbf75aef4c508d9f03e5e4661dc1 (patch) | |
tree | cb9dd43c4e7ba0543edaae0e838bb8cfa00ec3d2 | |
parent | 172ad46d5c457dda639376478e856a3c643635fa (diff) |
fixes #3317 completely
-rw-r--r-- | protocols/Telegram/src/auth.cpp | 19 | ||||
-rw-r--r-- | protocols/Telegram/src/proto.h | 1 |
2 files changed, 20 insertions, 0 deletions
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 @@ -29,6 +29,21 @@ INT_PTR CALLBACK CTelegramProto::EnterEmail(void *param) 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<CTelegramProto> OBJLIST<TG_FILE_REQUEST> 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); |