From c22db1db5ffd6a58749a21c7a3952937e993c60a Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 27 Feb 2017 18:22:26 +0000 Subject: [PATCH] Fix race when signup is completed elsewhere as commented --- src/components/structures/MatrixChat.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index 94d21f5024..382c854382 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -350,13 +350,21 @@ module.exports = React.createClass({ }); break; case 'start_upgrade_registration': - // stash our guest creds so we can backout if needed + // also stash our credentials, then if we restore the session, + // we can just do it the same way whether we started upgrade + // registration or explicitly logged out this.guestCreds = MatrixClientPeg.getCredentials(); this.setStateForNewScreen({ screen: "register", upgradeUsername: MatrixClientPeg.get().getUserIdLocalpart(), guestAccessToken: MatrixClientPeg.get().getAccessToken(), }); + + // stop the client: if we are syncing whilst the registration + // is completed in another browser, we'll be 401ed for using + // a guest access token for a non-guest account. + Lifecycle.stopMatrixClient(); + this.notifyNewScreen('register'); break; case 'start_password_recovery':