Handle cases of bad login info
parent
e73f9afa6c
commit
0e34a3b196
10
plchat.py
10
plchat.py
|
@ -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)
|
||||
|
|
|
@ -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')
|
||||
|
|
Loading…
Reference in New Issue