From 96c3bf56f8dbbbcd242bee9292ef87085414c63e Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Fri, 19 May 2017 09:43:56 +0100 Subject: [PATCH] Implement warm-fuzzy success dialog for SetMxIdDialog --- src/components/views/dialogs/SetMxIdDialog.js | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/src/components/views/dialogs/SetMxIdDialog.js b/src/components/views/dialogs/SetMxIdDialog.js index 86b5fccbc2..d9d07d517b 100644 --- a/src/components/views/dialogs/SetMxIdDialog.js +++ b/src/components/views/dialogs/SetMxIdDialog.js @@ -53,6 +53,9 @@ export default React.createClass({ doingUIAuth: false, // Indicate error with auth authError: '', + + // Indicate success of setting mxid + success: false, }; }, @@ -95,6 +98,10 @@ export default React.createClass({ }); }, + onSuccessContinue: function() { + this.props.onFinished(true, this._registeredCreds); + }, + _doUsernameCheck: function() { // Check if username is available return this._matrixClient.isUsernameAvailable(this.state.username).then( @@ -162,7 +169,7 @@ export default React.createClass({ // XXX Implement RTS /register here const teamToken = null; - this.props.onFinished(true, { + this._registeredCreds = { userId: response.user_id, deviceId: response.device_id, homeserverUrl: this._matrixClient.getHomeserverUrl(), @@ -170,6 +177,11 @@ export default React.createClass({ accessToken: response.access_token, password: this._generatedPassword, teamToken: teamToken, + }; + + // Before continuing, show a warm-fuzzy success and only submit onSuccessContinue + this.setState({ + success: true, }); }, @@ -219,6 +231,30 @@ export default React.createClass({ !this.state.usernameError && !this.state.usernameBusy; + if (this.state.success) { + return ( + +
+

+ You have successfully + picked { this.state.username } as your + username and you now have access to the full + set of features on Riot. +

+
+
+ +
+
+ ); + } + return (