Fix email registration, pt. 2
Regressed in https://github.com/matrix-org/matrix-react-sdk/pull/2768 where we check for an existing stored account first and restore that instead if it exist, telling the user. We usually make a guest account when the user first hits the page though, so this just restored this guest account. Don't restore the account if it's just a guest account (which, as per comment, is not perfect, but is definitely better than the current behaviour). Fixes https://github.com/vector-im/riot-web/issues/9581
This commit is contained in:
parent
a0ecd89c94
commit
c11d26d809
2 changed files with 25 additions and 12 deletions
|
@ -1712,9 +1712,13 @@ export default React.createClass({
|
|||
onRegistered: function(credentials) {
|
||||
if (this.state.register_session_id) {
|
||||
// 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, and
|
||||
// isn't a guest user since we'll usually have set a guest user session before
|
||||
// starting the registration process. This isn't perfect since it's possible
|
||||
// the user had a separate guest session they didn't actually mean to replace.
|
||||
const sessionOwner = Lifecycle.getStoredSessionOwner();
|
||||
if (sessionOwner && sessionOwner !== credentials.userId) {
|
||||
const sessionIsGuest = Lifecycle.getStoredSessionIsGuest();
|
||||
if (sessionOwner && !sessionIsGuest && sessionOwner !== credentials.userId) {
|
||||
console.log(
|
||||
`Found a session for ${sessionOwner} but ${credentials.userId} is trying to verify their ` +
|
||||
`email address. Restoring the session for ${sessionOwner} with warning.`,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue