From 0496171d20e5a6c665ea73eecf1e9825d1056dec Mon Sep 17 00:00:00 2001 From: Dominic Zimmer Date: Fri, 13 Sep 2019 21:16:34 +0200 Subject: [PATCH] Fix 2FA, now tested --- authview.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/authview.py b/authview.py index 154c7e1..ae84bec 100644 --- a/authview.py +++ b/authview.py @@ -63,6 +63,7 @@ class AuthView(): self.stdscr.addstr("Now authentificate with the code telegram sent to you.") self.stdscr.refresh() while True: + done = False try: self.code = await self.textinput() await self.client.sign_in(self.phone.replace("+","00").replace(" ",""), self.code) @@ -77,9 +78,13 @@ class AuthView(): self.passwd = await self.textinput() try: await self.client.sign_in(password=self.passwd) + done = True + break except telethon.errors.PasswordHashInvalidError: self.stdscr.addstr("Incorrect password. Try again.") self.stdscr.refresh() + if done: + break self.stdscr.addstr("Authentification successfull. Please wait until the client has finished loading.") self.stdscr.refresh()