From f1ea5ff6f39d831e61bb25dadf0889b55e572dae Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 11 Sep 2019 10:49:58 +0100 Subject: [PATCH 1/6] Login: don't assume supported flows, prevent login flash on SSO servers Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/auth/Login.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/structures/auth/Login.js b/src/components/structures/auth/Login.js index 014fb4426d..ab76c990b6 100644 --- a/src/components/structures/auth/Login.js +++ b/src/components/structures/auth/Login.js @@ -93,7 +93,7 @@ module.exports = createReactClass({ // Phase of the overall login dialog. phase: PHASE_LOGIN, // The current login flow, such as password, SSO, etc. - currentFlow: "m.login.password", + currentFlow: null, // we need to load the flows from the server // We perform liveliness checks later, but for now suppress the errors. // We also track the server dead errors independently of the regular errors so @@ -372,6 +372,7 @@ module.exports = createReactClass({ this.setState({ busy: true, + currentFlow: null, // reset flow loginIncorrect: false, }); From 1c7d67e8b3ff652b2220e6867f2f72069557df47 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 11 Sep 2019 11:01:06 +0100 Subject: [PATCH 2/6] fix test Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- test/components/structures/auth/Login-test.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/components/structures/auth/Login-test.js b/test/components/structures/auth/Login-test.js index 74451b922f..e79cf037d0 100644 --- a/test/components/structures/auth/Login-test.js +++ b/test/components/structures/auth/Login-test.js @@ -75,6 +75,11 @@ describe('Login', function() { const root = render(); + // Set non-empty flows & matrixClient to get past the loading spinner + root.setState({ + currentFlow: "m.login.password", + }); + const form = ReactTestUtils.findRenderedComponentWithType( root, sdk.getComponent('auth.PasswordLogin'), From bf30cfe6995799b997c705b2ce8bb49e015ffb11 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 11 Sep 2019 11:20:03 +0100 Subject: [PATCH 3/6] Fix other test Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- test/components/structures/auth/Login-test.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/components/structures/auth/Login-test.js b/test/components/structures/auth/Login-test.js index e79cf037d0..6a7982dd47 100644 --- a/test/components/structures/auth/Login-test.js +++ b/test/components/structures/auth/Login-test.js @@ -55,6 +55,11 @@ describe('Login', function() { it('should show form with change server link', function() { const root = render(); + // Set non-empty flows & matrixClient to get past the loading spinner + root.setState({ + currentFlow: "m.login.password", + }); + const form = ReactTestUtils.findRenderedComponentWithType( root, sdk.getComponent('auth.PasswordLogin'), From 76e4363452f4d175b55b28f850d85bdfefd95624 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 11 Sep 2019 12:20:36 +0100 Subject: [PATCH 4/6] Login: Add way to change HS from SSO Homeserver Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/auth/Login.js | 8 ++- src/components/views/auth/PasswordLogin.js | 35 ++---------- src/components/views/auth/SignInToText.js | 62 ++++++++++++++++++++++ 3 files changed, 72 insertions(+), 33 deletions(-) create mode 100644 src/components/views/auth/SignInToText.js diff --git a/src/components/structures/auth/Login.js b/src/components/structures/auth/Login.js index ab76c990b6..594a484bde 100644 --- a/src/components/structures/auth/Login.js +++ b/src/components/structures/auth/Login.js @@ -566,6 +566,7 @@ module.exports = createReactClass({ }, _renderSsoStep: function(url) { + const SignInToText = sdk.getComponent('views.auth.SignInToText'); // XXX: This link does *not* have a target="_blank" because single sign-on relies on // redirecting the user back to a URI once they're logged in. On the web, this means // we use the same window and redirect back to riot. On electron, this actually @@ -574,9 +575,12 @@ module.exports = createReactClass({ // If this bug gets fixed, it will break SSO since it will open the SSO page in the // user's browser, let them log into their SSO provider, then redirect their browser // to vector://vector which, of course, will not work. - return ( + return