Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Manage guest accounts better on the welcome page for auth #2819

Closed
wants to merge 3 commits into from

Conversation

turt2live
Copy link
Member

@turt2live turt2live commented Mar 23, 2019

Fixes element-hq/element-web#9224

Please review with element-hq/element-web#9275

Reviewer: The commits are probably of more interest than the words I put here.

This is ultimately the fix for element-hq/element-web#9224 however it is not really great. By not logging out of the guest account, getCurrentHsUrl() returns the wrong homeserver URL (matrix.org) instead of the discovered one.
In 5b2328b we log out of the guest account before moving on, however that doesn't solve the case of the guest account being wrong to begin with. We should still keep 5b2328b in the event this races, however this commit's goal is to use the right homeserver for the guest account once it has been discovered.
@turt2live turt2live requested a review from a team March 25, 2019 17:37
turt2live added a commit to element-hq/element-web that referenced this pull request Mar 25, 2019
@jryans jryans self-requested a review March 26, 2019 12:48
Copy link
Collaborator

@jryans jryans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... I'm not sure how I feel about this. 😕

It seems a bit confusing to have a potential flow of:

  1. Create guest account on config default HS
  2. Log it out and use discovered default HS
  3. Create second guest account on discovered default HS

(Am I correct that that's possible here?)

We have another issue in play that has caused @lampholder to start a flow chart of how all these defaults are meant to work. Maybe defining guests as part of that would help here?

What about blocking guest account creation until server discovery returns? That sounds like it might be simpler to follow.

// Change over the guest account, if one exists
if (MatrixClientPeg.get() && MatrixClientPeg.get().isGuest()) {
console.log("Discovered homeserver URLs - logging out current guest to use the homeserver");
Lifecycle.logout().then(() => this._loadSession());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, so this will remake a new guest account once we discover the HS?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, although it could probably do with a comment (or even better: not doing this and actually implementing the plan we talked about)

onLoggedOut();
}, 0);
return;
return new Promise((resolve, _reject) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I think it's more typical to not include reject at all if it's unused, at least for code I've seen here so far...

@turt2live
Copy link
Member Author

as per the issue, this is blocked on element-hq/element-web#9290

@turt2live
Copy link
Member Author

Closing - the solution for element-hq/element-web#9290 is more involved than what this covers, and so this needs to be reworked.

@turt2live turt2live closed this Apr 11, 2019
@turt2live turt2live deleted the travis/guest-server-name branch April 11, 2019 04:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants