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

Fix relationship between guests, .well-known, and auth #3001

Merged
merged 33 commits into from
May 23, 2019

Conversation

turt2live
Copy link
Member

@turt2live turt2live commented May 21, 2019

Reviewer: You may be wondering what part of this giant PR needs your attention, and luckily the answer isn't as scary as the diff. The bulk of this PR has already been reviewed (see the "includes" list below), however there are two commits which do need your seal of approval (see "new commits" list below). The remainder of the PR is really just getting your approval to throw this thing on develop and see how it works in the real world, now that the entire thing has been tested by hand. This PR also serves as a changelog entry for when we release.

Please review with element-hq/element-web#9779. The js-sdk parts of this have already landed on develop.

The primary change of this PR is to require that people configure their Riot with a homeserver it can use to run the app. With that homeserver, the app is expected to use that whenever possible for guest accounts and as a default option for users. Users can change which server they ultimately use, however there's plenty of guards in place to make sure the app has a good chance of actually running once they pass the login screen.

Or written in the form of a TLDR: This is a bunch of maintenance to fix a bunch of bugs and introduce a standardized behaviour for the app's homeserver handling.

New commits (need review):

Includes:

Fixes:

turt2live added 30 commits May 3, 2019 11:32
This also causes the components to produce a ValidatedServerConfig for use by other components.
The general idea is that we throw the object around between components so they can pull off the details they care about.
Like registration, the idea is that the object is passed around between components so they can take details they need.
Very similar to password resets and registration, the components pass around a server config for usage by other components. Login is a bit more complicated and needs a few more changes to pull the logic out to a more generic layer.
This way the server config is consistent across login, password reset, and registration. This also brings the code into a more generic place for all 3 duplicated efforts.
Use validated server config for login, registration, and password reset
TODO still remains about making ModularServerConfig extend ServerConfig instead of duplicating everything.

See element-hq/element-web#9290
The app is expected to flag a particular config themselves as default. This is primarily intended so that other parts of the app can determine what to do based on whether or not the config is a default config.

See element-hq/element-web#9290
Render underlines and tooltips on custom server names in auth pages
Refactor "Next" button into ServerConfig components
Only expose the fallback_hs_url if the homeserver is the default homeserver
If you were in the username field and simply tabbed out without entering anything, the form would become "busy" and not let you submit. We should only be doing this if we have work to do, like .well-known discovery of the homeserver.
This is often null while the component is on its first render, and is called during that render. It is eventually populated by React, and the function re-called - we just have to be patient.
@jryans jryans requested review from jryans and removed request for a team May 21, 2019 08:19
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.

Overall looks good! 😁 I would suggest waiting until after the RC on Wednesday before merging.

@@ -181,16 +181,8 @@ export default React.createClass({
// Parameters used in the registration dance with the IS
Copy link
Collaborator

Choose a reason for hiding this comment

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

Have you tested the email validation flow with these changes in place? (That's one area we've tended to break...)

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, several times.

Copy link
Member Author

Choose a reason for hiding this comment

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

just to follow up: I re-tested the two common scenarios just to be absolutely sure it works.


const MODULAR_URL = 'https://modular.im/?utm_source=riot-web&utm_medium=web&utm_campaign=riot-web-authentication';

// TODO: TravisR - Can this extend ServerConfig for most things?
Copy link
Collaborator

Choose a reason for hiding this comment

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

Probably so... At the time, it seemed as if it'd be more distinct.

Copy link
Member Author

Choose a reason for hiding this comment

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

I also forgot about this comment and have stuck it on my cleanup list. That list is getting long though, so at some point I'll just take a break from feature work to fix it.

src/components/views/auth/PasswordLogin.js Outdated Show resolved Hide resolved
src/utils/AutoDiscoveryUtils.js Show resolved Hide resolved
src/utils/TypeUtils.js Show resolved Hide resolved
@turt2live
Copy link
Member Author

RC cut, let's land this thing 🎉

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