From d7b2f0d3be76b3c7488ed6417da5197904e7fbfe Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Fri, 28 Apr 2017 14:32:08 +0100 Subject: [PATCH 01/63] CSS for new SetMxIdDialog --- src/skins/vector/css/_components.scss | 2 +- .../{_SetDisplayNameDialog.scss => _SetMxIdDialog.scss} | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) rename src/skins/vector/css/matrix-react-sdk/views/dialogs/{_SetDisplayNameDialog.scss => _SetMxIdDialog.scss} (92%) diff --git a/src/skins/vector/css/_components.scss b/src/skins/vector/css/_components.scss index df3c4600eb..54f6c79519 100644 --- a/src/skins/vector/css/_components.scss +++ b/src/skins/vector/css/_components.scss @@ -17,7 +17,7 @@ @import "./matrix-react-sdk/views/dialogs/_ChatInviteDialog.scss"; @import "./matrix-react-sdk/views/dialogs/_ConfirmUserActionDialog.scss"; @import "./matrix-react-sdk/views/dialogs/_EncryptedEventDialog.scss"; -@import "./matrix-react-sdk/views/dialogs/_SetDisplayNameDialog.scss"; +@import "./matrix-react-sdk/views/dialogs/_SetMxIdDialog.scss"; @import "./matrix-react-sdk/views/dialogs/_UnknownDeviceDialog.scss"; @import "./matrix-react-sdk/views/elements/_AccessibleButton.scss"; @import "./matrix-react-sdk/views/elements/_AddressSelector.scss"; diff --git a/src/skins/vector/css/matrix-react-sdk/views/dialogs/_SetDisplayNameDialog.scss b/src/skins/vector/css/matrix-react-sdk/views/dialogs/_SetMxIdDialog.scss similarity index 92% rename from src/skins/vector/css/matrix-react-sdk/views/dialogs/_SetDisplayNameDialog.scss rename to src/skins/vector/css/matrix-react-sdk/views/dialogs/_SetMxIdDialog.scss index 2f0750ad6b..4314a39f77 100644 --- a/src/skins/vector/css/matrix-react-sdk/views/dialogs/_SetDisplayNameDialog.scss +++ b/src/skins/vector/css/matrix-react-sdk/views/dialogs/_SetMxIdDialog.scss @@ -1,5 +1,6 @@ /* Copyright 2015, 2016 OpenMarket Ltd +Copyright 2017 Vector Creations Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,11 +15,11 @@ See the License for the specific language governing permissions and limitations under the License. */ -.mx_SetDisplayNameDialog_input { +.mx_SetMxIdDialog_input { border-radius: 3px; border: 1px solid $input-border-color; padding: 9px; color: $primary-fg-color; background-color: $primary-bg-color; font-size: 15px; -} \ No newline at end of file +} From f14c2a0a7119bd16209eb9f54a50d3249da0c035 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Fri, 5 May 2017 16:30:18 +0100 Subject: [PATCH 02/63] Implement PasswordNagBar This will tell the user that they need to set a password to return to their account. --- src/component-index.js | 6 +-- .../views/globals/PasswordNagBar.js | 47 +++++++++++++++++++ 2 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 src/components/views/globals/PasswordNagBar.js diff --git a/src/component-index.js b/src/component-index.js index 4bf0b0f984..c92437edd9 100644 --- a/src/component-index.js +++ b/src/component-index.js @@ -1,5 +1,6 @@ /* Copyright 2015, 2016 OpenMarket Ltd +Copyright 2017 Vector Creations Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,9 +20,6 @@ limitations under the License. * You can edit it you like, but your changes will be overwritten, * so you'd just be trying to swim upstream like a salmon. * You are not a salmon. - * - * To update it, run: - * ./reskindex.js -h header */ module.exports.components = require('matrix-react-sdk/lib/component-index').components; @@ -66,6 +64,8 @@ import views$globals$MatrixToolbar from './components/views/globals/MatrixToolba views$globals$MatrixToolbar && (module.exports.components['views.globals.MatrixToolbar'] = views$globals$MatrixToolbar); import views$globals$NewVersionBar from './components/views/globals/NewVersionBar'; views$globals$NewVersionBar && (module.exports.components['views.globals.NewVersionBar'] = views$globals$NewVersionBar); +import views$globals$PasswordNagBar from './components/views/globals/PasswordNagBar'; +views$globals$PasswordNagBar && (module.exports.components['views.globals.PasswordNagBar'] = views$globals$PasswordNagBar); import views$login$VectorCustomServerDialog from './components/views/login/VectorCustomServerDialog'; views$login$VectorCustomServerDialog && (module.exports.components['views.login.VectorCustomServerDialog'] = views$login$VectorCustomServerDialog); import views$login$VectorLoginFooter from './components/views/login/VectorLoginFooter'; diff --git a/src/components/views/globals/PasswordNagBar.js b/src/components/views/globals/PasswordNagBar.js new file mode 100644 index 0000000000..03a95566df --- /dev/null +++ b/src/components/views/globals/PasswordNagBar.js @@ -0,0 +1,47 @@ +/* +Copyright 2017 Vector Creations Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +'use strict'; + +import React from 'react'; +import sdk from 'matrix-react-sdk'; +import Modal from 'matrix-react-sdk/lib/Modal'; + +export default React.createClass({ + onUpdateClicked: function() { + // TODO: Implement dialog to set password + // const SetPasswordDialog = sdk.getComponent('dialogs.SetPasswordDialog'); + // Modal.createDialog(SetPasswordDialog, { + // onFinished: () => { + // } + // }); + }, + + render: function() { + const AccessibleButton = sdk.getComponent('elements.AccessibleButton'); + return ( +
+ /!\ +
+ To be able to return to your account, you need to set a password. +
+ +
+ ); + } +}); From c783f701ddc25897ab123406105a50daee0ac665 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Mon, 8 May 2017 10:01:18 +0100 Subject: [PATCH 03/63] reskindex --- src/component-index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/component-index.js b/src/component-index.js index c92437edd9..cdab24a40e 100644 --- a/src/component-index.js +++ b/src/component-index.js @@ -1,6 +1,5 @@ /* Copyright 2015, 2016 OpenMarket Ltd -Copyright 2017 Vector Creations Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -20,6 +19,9 @@ limitations under the License. * You can edit it you like, but your changes will be overwritten, * so you'd just be trying to swim upstream like a salmon. * You are not a salmon. + * + * To update it, run: + * ./reskindex.js -h header */ module.exports.components = require('matrix-react-sdk/lib/component-index').components; From 5766a6e93d2c7525e36dfafde6ddd712835195ca Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Mon, 8 May 2017 10:02:05 +0100 Subject: [PATCH 04/63] Give warning icon better alt --- src/components/views/globals/PasswordNagBar.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/views/globals/PasswordNagBar.js b/src/components/views/globals/PasswordNagBar.js index 03a95566df..11168403dc 100644 --- a/src/components/views/globals/PasswordNagBar.js +++ b/src/components/views/globals/PasswordNagBar.js @@ -34,7 +34,12 @@ export default React.createClass({ const AccessibleButton = sdk.getComponent('elements.AccessibleButton'); return (
- /!\ + Warning
To be able to return to your account, you need to set a password.
From 2e49014ffee8c119fd71f107cf0141acfbd46810 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Thu, 11 May 2017 09:33:52 +0100 Subject: [PATCH 05/63] CSS for mxIdDialog redesign --- src/skins/vector/css/_common.scss | 1 + .../views/dialogs/_SetMxIdDialog.scss | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/skins/vector/css/_common.scss b/src/skins/vector/css/_common.scss index 5b1d1de6f1..3048329436 100644 --- a/src/skins/vector/css/_common.scss +++ b/src/skins/vector/css/_common.scss @@ -248,6 +248,7 @@ textarea { .mx_Dialog_title { min-height: 16px; padding-top: 40px; + padding-right: 40px; font-weight: bold; font-size: 22px; line-height: 1.4; diff --git a/src/skins/vector/css/matrix-react-sdk/views/dialogs/_SetMxIdDialog.scss b/src/skins/vector/css/matrix-react-sdk/views/dialogs/_SetMxIdDialog.scss index 4314a39f77..9aec165f68 100644 --- a/src/skins/vector/css/matrix-react-sdk/views/dialogs/_SetMxIdDialog.scss +++ b/src/skins/vector/css/matrix-react-sdk/views/dialogs/_SetMxIdDialog.scss @@ -15,6 +15,10 @@ See the License for the specific language governing permissions and limitations under the License. */ +.mx_SetMxIdDialog_input_group { + display: flex; +} + .mx_SetMxIdDialog_input { border-radius: 3px; border: 1px solid $input-border-color; @@ -22,4 +26,21 @@ limitations under the License. color: $primary-fg-color; background-color: $primary-bg-color; font-size: 15px; + width: 100%; + max-width: 280px; } + +.mx_SetMxIdDialog_input.error, +.mx_SetMxIdDialog_input.error:focus { + border: 1px solid $warning-color; +} + +.mx_SetMxIdDialog_input_group .mx_Spinner { + height: 37px; + padding-left: 10px; + justify-content: flex-start; +} + +.mx_SetMxIdDialog .success { + color: $accent-color; +} \ No newline at end of file From 98f62d0300b1e8fc6690baa6f8d60d21fbbb4253 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Thu, 11 May 2017 09:40:06 +0100 Subject: [PATCH 06/63] NL at EOF --- src/component-index.js | 3 --- .../css/matrix-react-sdk/views/dialogs/_SetMxIdDialog.scss | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/component-index.js b/src/component-index.js index cdab24a40e..e737b3c684 100644 --- a/src/component-index.js +++ b/src/component-index.js @@ -19,9 +19,6 @@ limitations under the License. * You can edit it you like, but your changes will be overwritten, * so you'd just be trying to swim upstream like a salmon. * You are not a salmon. - * - * To update it, run: - * ./reskindex.js -h header */ module.exports.components = require('matrix-react-sdk/lib/component-index').components; diff --git a/src/skins/vector/css/matrix-react-sdk/views/dialogs/_SetMxIdDialog.scss b/src/skins/vector/css/matrix-react-sdk/views/dialogs/_SetMxIdDialog.scss index 9aec165f68..c4444918f5 100644 --- a/src/skins/vector/css/matrix-react-sdk/views/dialogs/_SetMxIdDialog.scss +++ b/src/skins/vector/css/matrix-react-sdk/views/dialogs/_SetMxIdDialog.scss @@ -43,4 +43,4 @@ limitations under the License. .mx_SetMxIdDialog .success { color: $accent-color; -} \ No newline at end of file +} From ab24994e37889368f27ff5177c04b317d4f74ed0 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Thu, 11 May 2017 09:42:21 +0100 Subject: [PATCH 07/63] Move general CSS to more specific so as not to affect other dialogs --- src/skins/vector/css/_common.scss | 1 - .../css/matrix-react-sdk/views/dialogs/_SetMxIdDialog.scss | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/skins/vector/css/_common.scss b/src/skins/vector/css/_common.scss index 3048329436..5b1d1de6f1 100644 --- a/src/skins/vector/css/_common.scss +++ b/src/skins/vector/css/_common.scss @@ -248,7 +248,6 @@ textarea { .mx_Dialog_title { min-height: 16px; padding-top: 40px; - padding-right: 40px; font-weight: bold; font-size: 22px; line-height: 1.4; diff --git a/src/skins/vector/css/matrix-react-sdk/views/dialogs/_SetMxIdDialog.scss b/src/skins/vector/css/matrix-react-sdk/views/dialogs/_SetMxIdDialog.scss index c4444918f5..f7d8a3d001 100644 --- a/src/skins/vector/css/matrix-react-sdk/views/dialogs/_SetMxIdDialog.scss +++ b/src/skins/vector/css/matrix-react-sdk/views/dialogs/_SetMxIdDialog.scss @@ -15,6 +15,10 @@ See the License for the specific language governing permissions and limitations under the License. */ +.mx_SetMxIdDialog .mx_Dialog_title { + padding-right: 40px; +} + .mx_SetMxIdDialog_input_group { display: flex; } From d2ea162b3f1ff730041bb57d8e3961d3f954802a Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Thu, 11 May 2017 10:11:30 +0100 Subject: [PATCH 08/63] Unmuddle the component-index header --- src/component-index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/component-index.js b/src/component-index.js index e737b3c684..cdab24a40e 100644 --- a/src/component-index.js +++ b/src/component-index.js @@ -19,6 +19,9 @@ limitations under the License. * You can edit it you like, but your changes will be overwritten, * so you'd just be trying to swim upstream like a salmon. * You are not a salmon. + * + * To update it, run: + * ./reskindex.js -h header */ module.exports.components = require('matrix-react-sdk/lib/component-index').components; From f60be2d658de118a5f22a3ed9041a0d0c0330b1c Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Fri, 12 May 2017 16:12:17 +0100 Subject: [PATCH 09/63] Add welcomeUserId to sample config --- config.sample.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config.sample.json b/config.sample.json index 3c513f7ab2..9be92fa747 100644 --- a/config.sample.json +++ b/config.sample.json @@ -10,5 +10,6 @@ "servers": [ "matrix.org" ] - } + }, + "welcomeUserId": "@RiotBot:matrix.org" } From 0e787a09c3682f6db84a38228577185faf816157 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Tue, 16 May 2017 09:44:52 +0100 Subject: [PATCH 10/63] Implement dialog to set password Until https://github.com/matrix-org/matrix-react-sdk/pull/881, ChangePassword will not know about the cached password (so it won't hide "Current Password" yet). There's also a bit of work left - informing the SessionStore that the password has changed (marked with a TODO) --- .../views/dialogs/SetPasswordDialog.js | 88 +++++++++++++++++++ .../views/globals/PasswordNagBar.js | 12 +-- src/skins/vector/css/_components.scss | 1 + .../views/dialogs/_SetPasswordDialog.scss | 35 ++++++++ 4 files changed, 130 insertions(+), 6 deletions(-) create mode 100644 src/components/views/dialogs/SetPasswordDialog.js create mode 100644 src/skins/vector/css/vector-web/views/dialogs/_SetPasswordDialog.scss diff --git a/src/components/views/dialogs/SetPasswordDialog.js b/src/components/views/dialogs/SetPasswordDialog.js new file mode 100644 index 0000000000..977fadbd43 --- /dev/null +++ b/src/components/views/dialogs/SetPasswordDialog.js @@ -0,0 +1,88 @@ +/* +Copyright 2016 OpenMarket Ltd +Copyright 2017 Vector Creations Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +import q from 'q'; +import React from 'react'; +import sdk from 'matrix-react-sdk'; +import {MatrixClientPeg} from 'matrix-react-sdk'; +import classnames from 'classnames'; + +/** + * Prompt the user to set a password + * + * On success, `onFinished()` when finished + */ +export default React.createClass({ + displayName: 'SetPasswordDialog', + propTypes: { + onFinished: React.PropTypes.func.isRequired, + }, + + getInitialState: function() { + return { + error: null, + }; + }, + + _onPasswordChanged: function() { + this.props.onFinished(); + }, + + _onPasswordChangeError: function(err) { + let errMsg = err.error || ""; + if (err.httpStatus === 403) { + errMsg = "Failed to change password. Is your password correct?"; + } else if (err.httpStatus) { + errMsg += ` (HTTP status ${err.httpStatus})`; + } + this.setState({ + error: errMsg, + }); + }, + + render: function() { + const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog'); + const ChangePassword = sdk.getComponent('views.settings.ChangePassword'); + const Spinner = sdk.getComponent('elements.Spinner'); + + return ( + +
+

+ This will allow you to return to your account after signing out, + and sign in on other devices. +

+ +
+ { this.state.error } +
+
+
+ ); + }, +}); diff --git a/src/components/views/globals/PasswordNagBar.js b/src/components/views/globals/PasswordNagBar.js index 11168403dc..a42706c3ae 100644 --- a/src/components/views/globals/PasswordNagBar.js +++ b/src/components/views/globals/PasswordNagBar.js @@ -22,12 +22,12 @@ import Modal from 'matrix-react-sdk/lib/Modal'; export default React.createClass({ onUpdateClicked: function() { - // TODO: Implement dialog to set password - // const SetPasswordDialog = sdk.getComponent('dialogs.SetPasswordDialog'); - // Modal.createDialog(SetPasswordDialog, { - // onFinished: () => { - // } - // }); + const SetPasswordDialog = sdk.getComponent('dialogs.SetPasswordDialog'); + Modal.createDialog(SetPasswordDialog, { + onFinished: () => { + //TODO: Notify SessionStore of changed password: dispatch password_changed + } + }); }, render: function() { diff --git a/src/skins/vector/css/_components.scss b/src/skins/vector/css/_components.scss index a0864817fe..b1964dca04 100644 --- a/src/skins/vector/css/_components.scss +++ b/src/skins/vector/css/_components.scss @@ -69,6 +69,7 @@ @import "./vector-web/views/context_menus/_MessageContextMenu.scss"; @import "./vector-web/views/context_menus/_RoomTileContextMenu.scss"; @import "./vector-web/views/dialogs/_ChangelogDialog.scss"; +@import "./vector-web/views/dialogs/_SetPasswordDialog.scss"; @import "./vector-web/views/directory/_NetworkDropdown.scss"; @import "./vector-web/views/elements/_ImageView.scss"; @import "./vector-web/views/elements/_Spinner.scss"; diff --git a/src/skins/vector/css/vector-web/views/dialogs/_SetPasswordDialog.scss b/src/skins/vector/css/vector-web/views/dialogs/_SetPasswordDialog.scss new file mode 100644 index 0000000000..28a8b7c9d7 --- /dev/null +++ b/src/skins/vector/css/vector-web/views/dialogs/_SetPasswordDialog.scss @@ -0,0 +1,35 @@ +/* +Copyright 2017 Vector Creations Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +.mx_SetPasswordDialog_change_password input { + border-radius: 3px; + border: 1px solid $input-border-color; + padding: 9px; + color: $primary-fg-color; + background-color: $primary-bg-color; + font-size: 15px; + width: 100%; + max-width: 280px; + margin-bottom: 10px; +} + +.mx_SetPasswordDialog_change_password_button { + margin-top: 68px; +} + +.mx_SetPasswordDialog .mx_Dialog_content { + margin-bottom: 0px; +} From 5814a3fdc8d82ac864ce271cd5211131b7aa9298 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Tue, 16 May 2017 10:11:44 +0100 Subject: [PATCH 11/63] Fix copyright --- src/components/views/dialogs/SetPasswordDialog.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/views/dialogs/SetPasswordDialog.js b/src/components/views/dialogs/SetPasswordDialog.js index 977fadbd43..1aabf1816d 100644 --- a/src/components/views/dialogs/SetPasswordDialog.js +++ b/src/components/views/dialogs/SetPasswordDialog.js @@ -1,5 +1,4 @@ /* -Copyright 2016 OpenMarket Ltd Copyright 2017 Vector Creations Ltd Licensed under the Apache License, Version 2.0 (the "License"); From 79d32868a6d804dbf305331b06aa1e3f1b5dd692 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Tue, 16 May 2017 11:39:30 +0100 Subject: [PATCH 12/63] Replace NeedToRegister with SetMxId dialog --- src/components/structures/RightPanel.js | 6 +----- src/components/structures/RoomDirectory.js | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/components/structures/RightPanel.js b/src/components/structures/RightPanel.js index 04a981196b..2c606e8c1d 100644 --- a/src/components/structures/RightPanel.js +++ b/src/components/structures/RightPanel.js @@ -89,11 +89,7 @@ module.exports = React.createClass({ onInviteButtonClick: function() { if (MatrixClientPeg.get().isGuest()) { - var NeedToRegisterDialog = sdk.getComponent("dialogs.NeedToRegisterDialog"); - Modal.createDialog(NeedToRegisterDialog, { - title: "Please Register", - description: "Guest users can't invite users. Please register to invite." - }); + dis.dispatch({action: 'view_set_mxid'}); return; } diff --git a/src/components/structures/RoomDirectory.js b/src/components/structures/RoomDirectory.js index 9104695938..964636579b 100644 --- a/src/components/structures/RoomDirectory.js +++ b/src/components/structures/RoomDirectory.js @@ -335,11 +335,7 @@ module.exports = React.createClass({ // to the directory. if (MatrixClientPeg.get().isGuest()) { if (!room.world_readable && !room.guest_can_join) { - var NeedToRegisterDialog = sdk.getComponent("dialogs.NeedToRegisterDialog"); - Modal.createDialog(NeedToRegisterDialog, { - title: "Failed to join the room", - description: "This room is inaccessible to guests. You may be able to join if you register." - }); + dis.dispatch({action: 'view_set_mxid'}); return; } } From e367fb5a987f6b3621704688eb3af7c6593bc9f5 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Tue, 16 May 2017 12:45:30 +0100 Subject: [PATCH 13/63] disabledConfirmation -> confirm --- src/components/views/dialogs/SetPasswordDialog.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/dialogs/SetPasswordDialog.js b/src/components/views/dialogs/SetPasswordDialog.js index 1aabf1816d..a0b6fd1e37 100644 --- a/src/components/views/dialogs/SetPasswordDialog.js +++ b/src/components/views/dialogs/SetPasswordDialog.js @@ -74,7 +74,7 @@ export default React.createClass({ rowLabelClassName="" rowInputClassName="" buttonClassName="mx_Dialog_primary mx_SetPasswordDialog_change_password_button" - disableConfirmation={true} + confirm={false} onError={this._onPasswordChangeError} onFinished={this._onPasswordChanged} />
From 48856c31f893815f3d3731717219d17db83dfc12 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Tue, 16 May 2017 13:48:56 +0100 Subject: [PATCH 14/63] Dispatch password_changed when SetPasswordDialog finished --- src/components/views/globals/PasswordNagBar.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/views/globals/PasswordNagBar.js b/src/components/views/globals/PasswordNagBar.js index a42706c3ae..b44950ad31 100644 --- a/src/components/views/globals/PasswordNagBar.js +++ b/src/components/views/globals/PasswordNagBar.js @@ -25,7 +25,10 @@ export default React.createClass({ const SetPasswordDialog = sdk.getComponent('dialogs.SetPasswordDialog'); Modal.createDialog(SetPasswordDialog, { onFinished: () => { - //TODO: Notify SessionStore of changed password: dispatch password_changed + // Notify SessionStore that the user's password was changed + dis.dispatch({ + action: 'password_changed', + }); } }); }, From 11d88aa6a2b9b1f447c432bb52eb72e2579f8bd8 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Tue, 16 May 2017 13:55:25 +0100 Subject: [PATCH 15/63] import dispatcher --- src/components/views/globals/PasswordNagBar.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/views/globals/PasswordNagBar.js b/src/components/views/globals/PasswordNagBar.js index b44950ad31..3fd0191a31 100644 --- a/src/components/views/globals/PasswordNagBar.js +++ b/src/components/views/globals/PasswordNagBar.js @@ -19,6 +19,7 @@ limitations under the License. import React from 'react'; import sdk from 'matrix-react-sdk'; import Modal from 'matrix-react-sdk/lib/Modal'; +import dis from 'matrix-react-sdk/lib/dispatcher'; export default React.createClass({ onUpdateClicked: function() { From 219bfffea293ed3f4171df130d5f4da1464bbd12 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Tue, 16 May 2017 14:24:09 +0100 Subject: [PATCH 16/63] Only dispatch password_changed when password has changed --- src/components/views/dialogs/SetPasswordDialog.js | 2 +- src/components/views/globals/PasswordNagBar.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/views/dialogs/SetPasswordDialog.js b/src/components/views/dialogs/SetPasswordDialog.js index a0b6fd1e37..e0bbee7da5 100644 --- a/src/components/views/dialogs/SetPasswordDialog.js +++ b/src/components/views/dialogs/SetPasswordDialog.js @@ -38,7 +38,7 @@ export default React.createClass({ }, _onPasswordChanged: function() { - this.props.onFinished(); + this.props.onFinished(true); }, _onPasswordChangeError: function(err) { diff --git a/src/components/views/globals/PasswordNagBar.js b/src/components/views/globals/PasswordNagBar.js index 3fd0191a31..f0fdee6c56 100644 --- a/src/components/views/globals/PasswordNagBar.js +++ b/src/components/views/globals/PasswordNagBar.js @@ -25,7 +25,10 @@ export default React.createClass({ onUpdateClicked: function() { const SetPasswordDialog = sdk.getComponent('dialogs.SetPasswordDialog'); Modal.createDialog(SetPasswordDialog, { - onFinished: () => { + onFinished: (passwordChanged) => { + if (!passwordChanged) { + return; + } // Notify SessionStore that the user's password was changed dis.dispatch({ action: 'password_changed', From 5d712d27d3ff869992653f4a576c935b8b1cd6ef Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Mon, 22 May 2017 14:45:40 +0100 Subject: [PATCH 17/63] autoFocus new password input in SetPasswordDialog --- src/components/views/dialogs/SetPasswordDialog.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/views/dialogs/SetPasswordDialog.js b/src/components/views/dialogs/SetPasswordDialog.js index e0bbee7da5..2db64d2f0c 100644 --- a/src/components/views/dialogs/SetPasswordDialog.js +++ b/src/components/views/dialogs/SetPasswordDialog.js @@ -75,6 +75,7 @@ export default React.createClass({ rowInputClassName="" buttonClassName="mx_Dialog_primary mx_SetPasswordDialog_change_password_button" confirm={false} + autoFocusNewPasswordInput={true} onError={this._onPasswordChangeError} onFinished={this._onPasswordChanged} />
From 9fc57786f139221073d02de79257507f6a5d1d80 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Mon, 22 May 2017 16:11:52 +0100 Subject: [PATCH 18/63] Add warm-fuzzy for successful password entry --- .../views/dialogs/SetPasswordDialog.js | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/components/views/dialogs/SetPasswordDialog.js b/src/components/views/dialogs/SetPasswordDialog.js index 2db64d2f0c..fb586cd072 100644 --- a/src/components/views/dialogs/SetPasswordDialog.js +++ b/src/components/views/dialogs/SetPasswordDialog.js @@ -34,10 +34,17 @@ export default React.createClass({ getInitialState: function() { return { error: null, + success: false, }; }, _onPasswordChanged: function() { + this.setState({ + success: true, + }); + }, + + _onContinueClicked: function() { this.props.onFinished(true); }, @@ -58,6 +65,30 @@ export default React.createClass({ const ChangePassword = sdk.getComponent('views.settings.ChangePassword'); const Spinner = sdk.getComponent('elements.Spinner'); + if (this.state.success) { + return ( + +
+

+ You can now return to your account after signing out, + and sign in on other devices. +

+
+
+ +
+
+ ); + } + return ( Date: Wed, 24 May 2017 17:58:03 +0100 Subject: [PATCH 19/63] Implement default welcome page and allow custom URL /w config counterpart to https://github.com/matrix-org/matrix-react-sdk/pull/922 --- config.sample.json | 3 ++- res/home.html | 9 +++++++++ scripts/copy-res.js | 1 + src/components/structures/BottomLeftMenu.js | 17 ++++------------- src/components/structures/HomePage.js | 15 ++++++++++++--- src/components/structures/LeftPanel.js | 3 +-- 6 files changed, 29 insertions(+), 19 deletions(-) create mode 100644 res/home.html diff --git a/config.sample.json b/config.sample.json index 9be92fa747..f26a6553f9 100644 --- a/config.sample.json +++ b/config.sample.json @@ -11,5 +11,6 @@ "matrix.org" ] }, - "welcomeUserId": "@RiotBot:matrix.org" + "welcomeUserId": "@RiotBot:matrix.org", + "welcomePageUrl": "https://about.riot.im" } diff --git a/res/home.html b/res/home.html new file mode 100644 index 0000000000..ddcfb0e887 --- /dev/null +++ b/res/home.html @@ -0,0 +1,9 @@ + + + + Riot - Home + + +
Welcome to Riot
+ + \ No newline at end of file diff --git a/scripts/copy-res.js b/scripts/copy-res.js index d3a2ee5e7b..c177925900 100755 --- a/scripts/copy-res.js +++ b/scripts/copy-res.js @@ -8,6 +8,7 @@ // "dest/b/...". const COPY_LIST = [ ["res/manifest.json", "webapp"], + ["res/home.html", "webapp"], ["res/{media,vector-icons}/**", "webapp"], ["res/flags/*", "webapp/flags/"], ["src/skins/vector/{fonts,img}/**", "webapp"], diff --git a/src/components/structures/BottomLeftMenu.js b/src/components/structures/BottomLeftMenu.js index f378cac628..f357bede96 100644 --- a/src/components/structures/BottomLeftMenu.js +++ b/src/components/structures/BottomLeftMenu.js @@ -27,7 +27,6 @@ module.exports = React.createClass({ propTypes: { collapsed: React.PropTypes.bool.isRequired, - teamToken: React.PropTypes.string, }, getInitialState: function() { @@ -114,21 +113,13 @@ module.exports = React.createClass({ render: function() { var TintableSvg = sdk.getComponent('elements.TintableSvg'); - - var homeButton; - if (this.props.teamToken) { - homeButton = ( - - - { this.getLabel("Welcome page", this.state.homeHover) } - - ); - } - return (
- { homeButton } + + + { this.getLabel("Welcome page", this.state.homeHover) } + { this.getLabel("Start chat", this.state.peopleHover) } diff --git a/src/components/structures/HomePage.js b/src/components/structures/HomePage.js index 8d44c90a2e..4f93eaae21 100644 --- a/src/components/structures/HomePage.js +++ b/src/components/structures/HomePage.js @@ -25,15 +25,24 @@ module.exports = React.createClass({ displayName: 'HomePage', propTypes: { + // URL base of the team server. teamServerUrl: React.PropTypes.string.isRequired, - teamToken: React.PropTypes.string.isRequired, - collapsedRhs: React.PropTypes.bool, + // Team token. Optional. If unset, the homePageUrl will be used + teamToken: React.PropTypes.string, + // URL to use as the iFrame src. Defaults to /home.html. + homePageUrl: React.PropTypes.string, }, render: function() { + let src = this.props.homePageUrl || '/home.html'; + + if (this.props.teamToken) { + src = `${this.props.teamServerUrl}/static/${this.props.teamToken}/home.html`; + } + return (
-