Fix email registration: pt. 1

We look to see if there's already a user logged in and if there is,
restore that session instead of logging the user in as their new
account. We still set this 'is_registered' flag though, even though
in that case it's not a newly registered account that's being restored,
so don't set in that case.
pull/21833/head
David Baker 2019-05-14 11:44:00 +01:00
parent 3b03e23ace
commit b6fd485dad
1 changed files with 3 additions and 3 deletions

View File

@ -1733,9 +1733,6 @@ export default React.createClass({
// returns a promise which resolves to the new MatrixClient // returns a promise which resolves to the new MatrixClient
onRegistered: function(credentials) { onRegistered: function(credentials) {
// XXX: This should be in state or ideally store(s) because we risk not
// rendering the most up-to-date view of state otherwise.
this._is_registered = true;
if (this.state.register_session_id) { if (this.state.register_session_id) {
// The user came in through an email validation link. To avoid overwriting // The user came in through an email validation link. To avoid overwriting
// their session, check to make sure the session isn't someone else. // their session, check to make sure the session isn't someone else.
@ -1771,6 +1768,9 @@ export default React.createClass({
return MatrixClientPeg.get(); return MatrixClientPeg.get();
} }
} }
// XXX: This should be in state or ideally store(s) because we risk not
// rendering the most up-to-date view of state otherwise.
this._is_registered = true;
return Lifecycle.setLoggedIn(credentials); return Lifecycle.setLoggedIn(credentials);
}, },