Handle cases of bad login info

develop
knotteye 2021-04-25 16:03:55 -05:00
parent e73f9afa6c
commit 0e34a3b196
2 changed files with 11 additions and 1 deletions

View File

@ -288,6 +288,10 @@ class App(QMainWindow):
# Returns username, instance
return self.acctComboBox.currentText().split('@')[1], self.acctComboBox.currentText().split('@')[2]
def badLogin(self, name):
self.Err.showMessage("Bad login info for: "+name)
self.newAcctDialog()
def newAcctDialog(self):
dialog = LoginDialog(self)
dialog.getInput(self.initAcct)
@ -1403,7 +1407,11 @@ class RegisterThread(threading.Thread):
def run(self):
self.acct.register()
self.acct.login()
try:
self.acct.login()
except ValueError:
ex._eventloop.call_soon_threadsafe(ex.badLogin, self.acct.username+'@'+self.acct.instance)
return
NotifThread(self.acct).start()
self.acct.setChatUpdate(ex.handlePleromaEvent)
self.callback(self.acct)

View File

@ -94,6 +94,8 @@ class Account():
'challenge_type': code_type,
'code': mfa_code
})
elif 'error' in response:
raise ValueError
self.token = response['access_token']
self.refresh_token = response['refresh_token']
r = self.apiRequest('GET', '/api/v1/accounts/verify_credentials')