From 88f351d5ca8e113b38f1b126d4b7e2ad5d544e3a Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Tue, 3 Mar 2020 10:40:58 +0000 Subject: [PATCH 1/3] Keep sign in button disabled on success This changes password login to keep the sign in button locked when proceeding successfully to avoid the possibility of double device sign in. Part of https://github.com/vector-im/riot-web/issues/12546 --- src/components/structures/auth/Login.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/components/structures/auth/Login.js b/src/components/structures/auth/Login.js index 24e4726416..589accacc3 100644 --- a/src/components/structures/auth/Login.js +++ b/src/components/structures/auth/Login.js @@ -245,6 +245,7 @@ export default createReactClass({ } this.setState({ + busy: false, errorText: errorText, // 401 would be the sensible status code for 'incorrect password' // but the login API gives a 403 https://matrix.org/jira/browse/SYN-744 @@ -252,13 +253,6 @@ export default createReactClass({ // We treat both as an incorrect password loginIncorrect: error.httpStatus === 401 || error.httpStatus === 403, }); - }).finally(() => { - if (this._unmounted) { - return; - } - this.setState({ - busy: false, - }); }); }, From 59c4e36ba884b7b32cf6d1b0e170092df1abd91d Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Tue, 3 Mar 2020 14:40:21 +0000 Subject: [PATCH 2/3] Lock interactive auth as busy until state change This keeps interactive auth locked as busy until a state change so that e.g. accepting a terms step will remain "busy looking" until the next step of the process appears. Fixes https://github.com/vector-im/riot-web/issues/12546 --- src/components/structures/InteractiveAuth.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/components/structures/InteractiveAuth.js b/src/components/structures/InteractiveAuth.js index 3d63029b06..9521dd76ec 100644 --- a/src/components/structures/InteractiveAuth.js +++ b/src/components/structures/InteractiveAuth.js @@ -161,6 +161,7 @@ export default createReactClass({ _authStateUpdated: function(stageType, stageState) { const oldStage = this.state.authStage; this.setState({ + busy: false, authStage: stageType, stageState: stageState, errorText: stageState.error, @@ -184,10 +185,6 @@ export default createReactClass({ errorText: null, stageErrorText: null, }); - } else { - this.setState({ - busy: false, - }); } }, From 191dcaab82b41d5659dfa3ba74f74205fec37fc9 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Tue, 3 Mar 2020 17:41:28 +0000 Subject: [PATCH 3/3] Explain why not busy is ignored --- src/components/structures/InteractiveAuth.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/components/structures/InteractiveAuth.js b/src/components/structures/InteractiveAuth.js index 9521dd76ec..f4adb5751f 100644 --- a/src/components/structures/InteractiveAuth.js +++ b/src/components/structures/InteractiveAuth.js @@ -186,6 +186,12 @@ export default createReactClass({ stageErrorText: null, }); } + // The JS SDK eagerly reports itself as "not busy" right after any + // immediate work has completed, but that's not really what we want at + // the UI layer, so we ignore this signal and show a spinner until + // there's a new screen to show the user. This is implemented by setting + // `busy: false` in `_authStateUpdated`. + // See also https://github.com/vector-im/riot-web/issues/12546 }, _setFocus: function() {