Commit a2af0f7e authored by talljosh's avatar talljosh

Fixed concurrency bug which resulted in welcome screen messages sometimes...

Fixed concurrency bug which resulted in welcome screen messages sometimes being shown in the wrong order.
parent 7ff4dc0e6be0
......@@ -57,7 +57,6 @@ class WelcomeScreenMessageViewer:
self.set_options(self.stack[-1])
def set_options(self, options: MessageViewerOptions):
self.stack.append(options)
self.message_text.setPlainText(options.message)
self.message_text.selectAll()
self.message_text.setAlignment(Qt.AlignCenter)
......
......@@ -952,9 +952,13 @@ class LoginPage:
async def ok_clicked(self):
try:
if self.creating_account:
await self.message_viewer.run_task('Creating account…', self.create_account())
success = await self.message_viewer.run_task(
'Creating account…', self.create_account())
else:
await self.message_viewer.run_task('Logging in…', self.login())
success = await self.message_viewer.run_task('Logging in…', self.login())
if success:
self.screen_runner.done(True)
except Exception as e:
self.screen_runner.error(e)
......@@ -971,10 +975,11 @@ class LoginPage:
if success:
if self.remember_me.isChecked():
self.auth_game.remember_token(username, response['token'])
self.screen_runner.done(True)
return True
else:
self.transient_message = 'Invalid username / password'
self.refresh_widget_states()
return False
async def create_account(self):
password = self.password_edit.text()
......@@ -982,7 +987,7 @@ class LoginPage:
if password != password2:
self.transient_message = 'Passwords do not match'
self.refresh_widget_states()
return
return False
username = self.username_edit.text()
response = await as_future(self.auth_connection.callRemote(
......@@ -994,10 +999,10 @@ class LoginPage:
if error_string:
self.transient_message = error_string
self.refresh_widget_states()
return
return False
self.auth_game.remember_token(username, response['token'])
self.screen_runner.done(True)
return True
def back_clicked(self):
self.screen_runner.done(False)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment