From 4bbd507e7abc7bf7bae1f15d25387bdc5ba55e31 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 22 Apr 2020 11:33:45 +0100 Subject: [PATCH 01/18] If user cannot set email during registration don't tell them to Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/auth/RegistrationForm.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/views/auth/RegistrationForm.js b/src/components/views/auth/RegistrationForm.js index a89f8c6298..f1624bc9e5 100644 --- a/src/components/views/auth/RegistrationForm.js +++ b/src/components/views/auth/RegistrationForm.js @@ -102,11 +102,15 @@ export default createReactClass({ "No identity server is configured so you cannot add an email address in order to " + "reset your password in the future.", ); - } else { + } else if (this._showEmail()) { desc = _t( "If you don't specify an email address, you won't be able to reset your password. " + "Are you sure?", ); + } else { + // user can't set an e-mail so don't prompt them to + self._doSubmit(ev); + return; } const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog"); From fc828378fa1bbb26d1483e7ce3cea82318adcedc Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 22 Apr 2020 13:18:54 +0100 Subject: [PATCH 02/18] Fix post-ts autocomplete, it is not null Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/autocomplete/AutocompleteProvider.tsx | 2 +- src/autocomplete/UserProvider.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/autocomplete/AutocompleteProvider.tsx b/src/autocomplete/AutocompleteProvider.tsx index 2cda2593a4..a40ce7144d 100644 --- a/src/autocomplete/AutocompleteProvider.tsx +++ b/src/autocomplete/AutocompleteProvider.tsx @@ -64,7 +64,7 @@ export default class AutocompleteProvider { commandRegex = this.forcedCommandRegex || /\S+/g; } - if (commandRegex === null) { + if (!commandRegex) { return null; } diff --git a/src/autocomplete/UserProvider.tsx b/src/autocomplete/UserProvider.tsx index 357c8750f7..1680eb5d54 100644 --- a/src/autocomplete/UserProvider.tsx +++ b/src/autocomplete/UserProvider.tsx @@ -102,7 +102,7 @@ export default class UserProvider extends AutocompleteProvider { const MemberAvatar = sdk.getComponent('views.avatars.MemberAvatar'); // lazy-load user list into matcher - if (this.users === null) this._makeUsers(); + if (!this.users) this._makeUsers(); let completions = []; const {command, range} = this.getCurrentCommand(rawQuery, selection, force); @@ -158,7 +158,7 @@ export default class UserProvider extends AutocompleteProvider { } onUserSpoke(user: RoomMember) { - if (this.users === null) return; + if (!this.users) return; if (!user) return; if (user.userId === MatrixClientPeg.get().credentials.userId) return; From 162531f1c59109955bbaaa196d8f5198f502ff99 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 22 Apr 2020 13:36:14 +0100 Subject: [PATCH 03/18] try to enable e2e test synapse registration 3pid support Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- .../synapse/config-templates/consent/homeserver.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/end-to-end-tests/synapse/config-templates/consent/homeserver.yaml b/test/end-to-end-tests/synapse/config-templates/consent/homeserver.yaml index e07cf585d8..f9e62c94a6 100644 --- a/test/end-to-end-tests/synapse/config-templates/consent/homeserver.yaml +++ b/test/end-to-end-tests/synapse/config-templates/consent/homeserver.yaml @@ -642,7 +642,8 @@ enable_registration: true # Explicitly disable asking for MSISDNs from the registration # flow (overrides registrations_require_3pid if MSISDNs are set as required) # -#disable_msisdn_registration: true +disable_msisdn_registration: false +threepid_behaviour_email: "local" # Mandate that users are only allowed to associate certain formats of # 3PIDs with accounts on this server. From 59cc7f0867fa9ff1d7c4603c8199e7c827070faf Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 22 Apr 2020 13:50:40 +0100 Subject: [PATCH 04/18] here's hoping Synapse doesn't actually try to send an email :D Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- .../config-templates/consent/homeserver.yaml | 33 +++++++++---------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/test/end-to-end-tests/synapse/config-templates/consent/homeserver.yaml b/test/end-to-end-tests/synapse/config-templates/consent/homeserver.yaml index f9e62c94a6..536c017b9e 100644 --- a/test/end-to-end-tests/synapse/config-templates/consent/homeserver.yaml +++ b/test/end-to-end-tests/synapse/config-templates/consent/homeserver.yaml @@ -643,7 +643,6 @@ enable_registration: true # flow (overrides registrations_require_3pid if MSISDNs are set as required) # disable_msisdn_registration: false -threepid_behaviour_email: "local" # Mandate that users are only allowed to associate certain formats of # 3PIDs with accounts on this server. @@ -883,22 +882,22 @@ password_config: # If your SMTP server requires authentication, the optional smtp_user & # smtp_pass variables should be used # -#email: -# enable_notifs: false -# smtp_host: "localhost" -# smtp_port: 25 -# smtp_user: "exampleusername" -# smtp_pass: "examplepassword" -# require_transport_security: False -# notif_from: "Your Friendly %(app)s Home Server " -# app_name: Matrix -# # if template_dir is unset, uses the example templates that are part of -# # the Synapse distribution. -# #template_dir: res/templates -# notif_template_html: notif_mail.html -# notif_template_text: notif_mail.txt -# notif_for_new_users: True -# riot_base_url: "http://localhost/riot" +email: + enable_notifs: false + smtp_host: "localhost" + smtp_port: 25 + smtp_user: "exampleusername" + smtp_pass: "examplepassword" + require_transport_security: False + notif_from: "Your Friendly %(app)s Home Server " + app_name: Matrix + # if template_dir is unset, uses the example templates that are part of + # the Synapse distribution. + #template_dir: res/templates + notif_template_html: notif_mail.html + notif_template_text: notif_mail.txt + notif_for_new_users: True + riot_base_url: "http://localhost/riot" #password_providers: From 8536e087ab8624d58885510c8038966e86031439 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Wed, 22 Apr 2020 14:45:50 +0100 Subject: [PATCH 05/18] Skip auth flow test for signing upload when password present If we already have an account password to use during secret storage setup, then it's highly likely that the homeserver accepts passwords for device signing key upload as well. This change then assumes password auth will work without checking to avoid a request when the server is under high load. Fixes https://github.com/vector-im/riot-web/issues/13286 --- .../dialogs/secretstorage/CreateSecretStorageDialog.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/async-components/views/dialogs/secretstorage/CreateSecretStorageDialog.js b/src/async-components/views/dialogs/secretstorage/CreateSecretStorageDialog.js index c5c734a813..2c05f231e7 100644 --- a/src/async-components/views/dialogs/secretstorage/CreateSecretStorageDialog.js +++ b/src/async-components/views/dialogs/secretstorage/CreateSecretStorageDialog.js @@ -83,7 +83,15 @@ export default class CreateSecretStorageDialog extends React.PureComponent { }; this._fetchBackupInfo(); - this._queryKeyUploadAuth(); + if (this.state.accountPassword) { + // If we have an account password in memory, let's simplify and + // assume it means password auth is also supported for device + // signing key upload as well. This avoids hitting the server to + // test auth flows, which may be slow under high load. + this.state.canUploadKeysWithPasswordOnly = true; + } else { + this._queryKeyUploadAuth(); + } MatrixClientPeg.get().on('crypto.keyBackupStatus', this._onKeyBackupStatusChange); } From 7a42caa326a775ab37e9360aa956525281a93c57 Mon Sep 17 00:00:00 2001 From: Agusti Bau Date: Tue, 21 Apr 2020 22:25:37 +0200 Subject: [PATCH 06/18] Fixed Unignore state variable naming missmatch Signed-off-by: Agusti Bau --- .../settings/tabs/user/SecurityUserSettingsTab.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js b/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js index 1cde5d6f87..72ec30cdb1 100644 --- a/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js @@ -89,13 +89,13 @@ export default class SecurityUserSettingsTab extends React.Component { // Don't use this.state to get the ignored user list as it might be // ever so slightly outdated. Instead, prefer to get a fresh list and // update that. - const ignoredUsers = MatrixClientPeg.get().getIgnoredUsers(); - const index = ignoredUsers.indexOf(userId); + const ignoredUserIds = MatrixClientPeg.get().getIgnoredUsers(); + const index = ignoredUserIds.indexOf(userId); if (index !== -1) { - ignoredUsers.splice(index, 1); - MatrixClientPeg.get().setIgnoredUsers(ignoredUsers); + ignoredUserIds.splice(index, 1); + MatrixClientPeg.get().setIgnoredUsers(ignoredUserIds); } - this.setState({ignoredUsers}); + this.setState({ignoredUserIds}); }; _getInvitedRooms = () => { From 47708ca1275f019a3842011fbee300cf825f4eb4 Mon Sep 17 00:00:00 2001 From: Agusti Bau Date: Wed, 22 Apr 2020 01:31:35 +0200 Subject: [PATCH 07/18] Sync settings ignoredUsers with global state Signed-off-by: Agusti Bau --- .../tabs/user/SecurityUserSettingsTab.js | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js b/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js index 72ec30cdb1..c9f3c73905 100644 --- a/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js @@ -25,6 +25,7 @@ import Analytics from "../../../../../Analytics"; import Modal from "../../../../../Modal"; import * as sdk from "../../../../.."; import {sleep} from "../../../../../utils/promise"; +import dis from "../../../../../dispatcher" export class IgnoredUser extends React.Component { static propTypes = { @@ -61,6 +62,23 @@ export default class SecurityUserSettingsTab extends React.Component { managingInvites: false, invitedRoomAmt: invitedRooms.length, }; + + this._onAction = this._onAction.bind(this); + } + + _onAction({action}) { + if (action === "ignore_state_changed"){ + const ignoredUserIds = MatrixClientPeg.get().getIgnoredUsers(); + this.setState({ignoredUserIds}) + } + } + + componentDidMount() { + this.dispatcherRef = dis.register(this._onAction) + } + + componentWillUnmount() { + dis.unregister(this.dispatcherRef); } _updateBlacklistDevicesFlag = (checked) => { @@ -89,13 +107,13 @@ export default class SecurityUserSettingsTab extends React.Component { // Don't use this.state to get the ignored user list as it might be // ever so slightly outdated. Instead, prefer to get a fresh list and // update that. - const ignoredUserIds = MatrixClientPeg.get().getIgnoredUsers(); + const ignoredUserIds = this.state.ignoredUserIds; const index = ignoredUserIds.indexOf(userId); if (index !== -1) { ignoredUserIds.splice(index, 1); MatrixClientPeg.get().setIgnoredUsers(ignoredUserIds); } - this.setState({ignoredUserIds}); + }; _getInvitedRooms = () => { From 08bac716d5f1690e11b9f5585bac3df4f15c2652 Mon Sep 17 00:00:00 2001 From: Agusti Bau Date: Wed, 22 Apr 2020 16:00:27 +0200 Subject: [PATCH 08/18] Disabled unignore button when unignoring in process Signed-off-by: Agusti Bau --- .../tabs/user/SecurityUserSettingsTab.js | 44 ++++++++++++++----- 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js b/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js index c9f3c73905..a5ef16cc04 100644 --- a/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js @@ -31,6 +31,7 @@ export class IgnoredUser extends React.Component { static propTypes = { userId: PropTypes.string.isRequired, onUnignored: PropTypes.func.isRequired, + inProgress: PropTypes.bool.isRequired }; _onUnignoreClicked = (e) => { @@ -41,7 +42,7 @@ export class IgnoredUser extends React.Component { const id = `mx_SecurityUserSettingsTab_ignoredUser_${this.props.userId}`; return (
- + { _t('Unignore') } { this.props.userId } @@ -59,6 +60,7 @@ export default class SecurityUserSettingsTab extends React.Component { this.state = { ignoredUserIds: MatrixClientPeg.get().getIgnoredUsers(), + waitingUnignored: [], managingInvites: false, invitedRoomAmt: invitedRooms.length, }; @@ -69,7 +71,13 @@ export default class SecurityUserSettingsTab extends React.Component { _onAction({action}) { if (action === "ignore_state_changed"){ const ignoredUserIds = MatrixClientPeg.get().getIgnoredUsers(); - this.setState({ignoredUserIds}) + const newWaitingUnignored = this.state.waitingUnignored.filter(e=> ignoredUserIds.includes(e)) + console.log("-------------") + console.log("Got new ignored users", ignoredUserIds) + console.log("We were waiting for", this.state.waitingUnignored) + console.log("Now we wait for", newWaitingUnignored) + console.log("-------------") + this.setState({ignoredUserIds, waitingUnignored: newWaitingUnignored}) } } @@ -104,14 +112,20 @@ export default class SecurityUserSettingsTab extends React.Component { }; _onUserUnignored = async (userId) => { - // Don't use this.state to get the ignored user list as it might be - // ever so slightly outdated. Instead, prefer to get a fresh list and - // update that. - const ignoredUserIds = this.state.ignoredUserIds; - const index = ignoredUserIds.indexOf(userId); + + const {ignoredUserIds, waitingUnignored} = this.state + console.log("--------GO IGNORE---") + console.log("ignored:", ignoredUserIds) + console.log("waiting for:", waitingUnignored) + const currentlyIgnoredUserIds = ignoredUserIds.filter(e=> !waitingUnignored.includes(e)); + console.log("currentlyIgnored:", currentlyIgnoredUserIds) + + const index = currentlyIgnoredUserIds.indexOf(userId); if (index !== -1) { - ignoredUserIds.splice(index, 1); - MatrixClientPeg.get().setIgnoredUsers(ignoredUserIds); + currentlyIgnoredUserIds.splice(index, 1); + this.setState(({waitingUnignored})=>({waitingUnignored:[...waitingUnignored, userId]})) + console.log("Sending to server", currentlyIgnoredUserIds) + MatrixClientPeg.get().setIgnoredUsers(currentlyIgnoredUserIds); } }; @@ -219,10 +233,16 @@ export default class SecurityUserSettingsTab extends React.Component { } _renderIgnoredUsers() { - if (!this.state.ignoredUserIds || this.state.ignoredUserIds.length === 0) return null; + const {waitingUnignored, ignoredUserIds} = this.state; - const userIds = this.state.ignoredUserIds - .map((u) => ); + if (!ignoredUserIds || ignoredUserIds.length === 0) return null; + + + console.log("Rendering, waiting", waitingUnignored) + console.log("Rendering, ignored", ignoredUserIds) + + const userIds = ignoredUserIds + .map((u) => ); return (
From cd87124e0f2ddd30213f071814f36b55cc183c64 Mon Sep 17 00:00:00 2001 From: Agusti Bau Date: Wed, 22 Apr 2020 16:16:49 +0200 Subject: [PATCH 09/18] removed console logs Signed-off-by: Agusti Bau --- .../tabs/user/SecurityUserSettingsTab.js | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js b/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js index a5ef16cc04..187ad0fb93 100644 --- a/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js @@ -68,15 +68,12 @@ export default class SecurityUserSettingsTab extends React.Component { this._onAction = this._onAction.bind(this); } + + _onAction({action}) { if (action === "ignore_state_changed"){ const ignoredUserIds = MatrixClientPeg.get().getIgnoredUsers(); const newWaitingUnignored = this.state.waitingUnignored.filter(e=> ignoredUserIds.includes(e)) - console.log("-------------") - console.log("Got new ignored users", ignoredUserIds) - console.log("We were waiting for", this.state.waitingUnignored) - console.log("Now we wait for", newWaitingUnignored) - console.log("-------------") this.setState({ignoredUserIds, waitingUnignored: newWaitingUnignored}) } } @@ -114,17 +111,12 @@ export default class SecurityUserSettingsTab extends React.Component { _onUserUnignored = async (userId) => { const {ignoredUserIds, waitingUnignored} = this.state - console.log("--------GO IGNORE---") - console.log("ignored:", ignoredUserIds) - console.log("waiting for:", waitingUnignored) const currentlyIgnoredUserIds = ignoredUserIds.filter(e=> !waitingUnignored.includes(e)); - console.log("currentlyIgnored:", currentlyIgnoredUserIds) const index = currentlyIgnoredUserIds.indexOf(userId); if (index !== -1) { currentlyIgnoredUserIds.splice(index, 1); this.setState(({waitingUnignored})=>({waitingUnignored:[...waitingUnignored, userId]})) - console.log("Sending to server", currentlyIgnoredUserIds) MatrixClientPeg.get().setIgnoredUsers(currentlyIgnoredUserIds); } @@ -237,10 +229,6 @@ export default class SecurityUserSettingsTab extends React.Component { if (!ignoredUserIds || ignoredUserIds.length === 0) return null; - - console.log("Rendering, waiting", waitingUnignored) - console.log("Rendering, ignored", ignoredUserIds) - const userIds = ignoredUserIds .map((u) => ); From ff3272061cc994412892181fd55cbb0e44737c79 Mon Sep 17 00:00:00 2001 From: Agusti Bau Date: Wed, 22 Apr 2020 16:44:47 +0200 Subject: [PATCH 10/18] Fixed linter errors Signed-off-by: Agusti Bau --- .../tabs/user/SecurityUserSettingsTab.js | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js b/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js index 187ad0fb93..686873d6b0 100644 --- a/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js @@ -25,13 +25,13 @@ import Analytics from "../../../../../Analytics"; import Modal from "../../../../../Modal"; import * as sdk from "../../../../.."; import {sleep} from "../../../../../utils/promise"; -import dis from "../../../../../dispatcher" +import dis from "../../../../../dispatcher"; export class IgnoredUser extends React.Component { static propTypes = { userId: PropTypes.string.isRequired, onUnignored: PropTypes.func.isRequired, - inProgress: PropTypes.bool.isRequired + inProgress: PropTypes.bool.isRequired, }; _onUnignoreClicked = (e) => { @@ -69,17 +69,16 @@ export default class SecurityUserSettingsTab extends React.Component { } - _onAction({action}) { - if (action === "ignore_state_changed"){ - const ignoredUserIds = MatrixClientPeg.get().getIgnoredUsers(); - const newWaitingUnignored = this.state.waitingUnignored.filter(e=> ignoredUserIds.includes(e)) - this.setState({ignoredUserIds, waitingUnignored: newWaitingUnignored}) + if (action === "ignore_state_changed") { + const ignoredUserIds = MatrixClientPeg.get().getIgnoredUsers(); + const newWaitingUnignored = this.state.waitingUnignored.filter(e=> ignoredUserIds.includes(e)); + this.setState({ignoredUserIds, waitingUnignored: newWaitingUnignored}); } } componentDidMount() { - this.dispatcherRef = dis.register(this._onAction) + this.dispatcherRef = dis.register(this._onAction); } componentWillUnmount() { @@ -109,17 +108,15 @@ export default class SecurityUserSettingsTab extends React.Component { }; _onUserUnignored = async (userId) => { - - const {ignoredUserIds, waitingUnignored} = this.state + const {ignoredUserIds, waitingUnignored} = this.state; const currentlyIgnoredUserIds = ignoredUserIds.filter(e=> !waitingUnignored.includes(e)); const index = currentlyIgnoredUserIds.indexOf(userId); if (index !== -1) { currentlyIgnoredUserIds.splice(index, 1); - this.setState(({waitingUnignored})=>({waitingUnignored:[...waitingUnignored, userId]})) + this.setState(({waitingUnignored})=>({waitingUnignored: [...waitingUnignored, userId]})); MatrixClientPeg.get().setIgnoredUsers(currentlyIgnoredUserIds); } - }; _getInvitedRooms = () => { @@ -230,7 +227,12 @@ export default class SecurityUserSettingsTab extends React.Component { if (!ignoredUserIds || ignoredUserIds.length === 0) return null; const userIds = ignoredUserIds - .map((u) => ); + .map((u) => ); return (
From 5163232081b3a5da35175ea659072175cc3c898c Mon Sep 17 00:00:00 2001 From: Agusti Bau Date: Wed, 22 Apr 2020 20:03:13 +0200 Subject: [PATCH 11/18] Update src/components/views/settings/tabs/user/SecurityUserSettingsTab.js Co-Authored-By: Michael Telatynski <7t3chguy@googlemail.com> --- .../views/settings/tabs/user/SecurityUserSettingsTab.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js b/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js index 686873d6b0..5260fed1b5 100644 --- a/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js @@ -114,7 +114,7 @@ export default class SecurityUserSettingsTab extends React.Component { const index = currentlyIgnoredUserIds.indexOf(userId); if (index !== -1) { currentlyIgnoredUserIds.splice(index, 1); - this.setState(({waitingUnignored})=>({waitingUnignored: [...waitingUnignored, userId]})); + this.setState(({waitingUnignored}) => ({waitingUnignored: [...waitingUnignored, userId]})); MatrixClientPeg.get().setIgnoredUsers(currentlyIgnoredUserIds); } }; From 2471b3c1004509be2ffe3653287476ce5722bba6 Mon Sep 17 00:00:00 2001 From: Agusti Bau Date: Wed, 22 Apr 2020 20:03:22 +0200 Subject: [PATCH 12/18] Update src/components/views/settings/tabs/user/SecurityUserSettingsTab.js Co-Authored-By: Michael Telatynski <7t3chguy@googlemail.com> --- .../views/settings/tabs/user/SecurityUserSettingsTab.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js b/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js index 5260fed1b5..6c9309f38a 100644 --- a/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/SecurityUserSettingsTab.js @@ -109,7 +109,7 @@ export default class SecurityUserSettingsTab extends React.Component { _onUserUnignored = async (userId) => { const {ignoredUserIds, waitingUnignored} = this.state; - const currentlyIgnoredUserIds = ignoredUserIds.filter(e=> !waitingUnignored.includes(e)); + const currentlyIgnoredUserIds = ignoredUserIds.filter(e => !waitingUnignored.includes(e)); const index = currentlyIgnoredUserIds.indexOf(userId); if (index !== -1) { From ae3dcff230031b0ab7bd111165233c94d0960e6a Mon Sep 17 00:00:00 2001 From: Sergey Shpikin Date: Wed, 22 Apr 2020 21:42:43 +0300 Subject: [PATCH 13/18] Assert type of domNode as HTMLElement to fix build Signed-off-by: Sergey Shpikin --- src/components/views/rooms/Autocomplete.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/rooms/Autocomplete.tsx b/src/components/views/rooms/Autocomplete.tsx index 6843df4121..975c8e84a5 100644 --- a/src/components/views/rooms/Autocomplete.tsx +++ b/src/components/views/rooms/Autocomplete.tsx @@ -259,7 +259,7 @@ export default class Autocomplete extends React.PureComponent { const selectedCompletion = this.refs[`completion${this.state.selectionOffset}`]; if (selectedCompletion && this.containerRef.current) { const domNode = ReactDOM.findDOMNode(selectedCompletion); - const offsetTop = domNode && domNode.offsetTop; + const offsetTop = domNode && (domNode as HTMLElement).offsetTop; if (offsetTop > this.containerRef.current.scrollTop + this.containerRef.current.offsetHeight || offsetTop < this.containerRef.current.scrollTop) { this.containerRef.current.scrollTop = offsetTop - this.containerRef.current.offsetTop; From b10a38667522b31decb878e869b9b41bedee4457 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 22 Apr 2020 21:37:52 +0100 Subject: [PATCH 14/18] Fix i18n of SSO UIA copy in Deactivate Account Dialog Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- .../views/dialogs/DeactivateAccountDialog.js | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/components/views/dialogs/DeactivateAccountDialog.js b/src/components/views/dialogs/DeactivateAccountDialog.js index 3889f0989a..b269ec2fdb 100644 --- a/src/components/views/dialogs/DeactivateAccountDialog.js +++ b/src/components/views/dialogs/DeactivateAccountDialog.js @@ -26,30 +26,6 @@ import { _t } from '../../../languageHandler'; import InteractiveAuth, {ERROR_USER_CANCELLED} from "../../structures/InteractiveAuth"; import {DEFAULT_PHASE, PasswordAuthEntry, SSOAuthEntry} from "../auth/InteractiveAuthEntryComponents"; -const dialogAesthetics = { - [SSOAuthEntry.PHASE_PREAUTH]: { - body: _t("Confirm your account deactivation by using Single Sign On to prove your identity."), - continueText: _t("Single Sign On"), - continueKind: "danger", - }, - [SSOAuthEntry.PHASE_POSTAUTH]: { - body: _t("Are you sure you want to deactivate your account? This is irreversible."), - continueText: _t("Confirm account deactivation"), - continueKind: "danger", - }, -}; - -// This is the same as aestheticsForStagePhases in InteractiveAuthDialog minus the `title` -const DEACTIVATE_AESTHETICS = { - [SSOAuthEntry.LOGIN_TYPE]: dialogAesthetics, - [SSOAuthEntry.UNSTABLE_LOGIN_TYPE]: dialogAesthetics, - [PasswordAuthEntry.LOGIN_TYPE]: { - [DEFAULT_PHASE]: { - body: _t("To continue, please enter your password:"), - }, - }, -}; - export default class DeactivateAccountDialog extends React.Component { constructor(props) { super(props); @@ -84,6 +60,30 @@ export default class DeactivateAccountDialog extends React.Component { } _onStagePhaseChange = (stage, phase) => { + const dialogAesthetics = { + [SSOAuthEntry.PHASE_PREAUTH]: { + body: _t("Confirm your account deactivation by using Single Sign On to prove your identity."), + continueText: _t("Single Sign On"), + continueKind: "danger", + }, + [SSOAuthEntry.PHASE_POSTAUTH]: { + body: _t("Are you sure you want to deactivate your account? This is irreversible."), + continueText: _t("Confirm account deactivation"), + continueKind: "danger", + }, + }; + + // This is the same as aestheticsForStagePhases in InteractiveAuthDialog minus the `title` + const DEACTIVATE_AESTHETICS = { + [SSOAuthEntry.LOGIN_TYPE]: dialogAesthetics, + [SSOAuthEntry.UNSTABLE_LOGIN_TYPE]: dialogAesthetics, + [PasswordAuthEntry.LOGIN_TYPE]: { + [DEFAULT_PHASE]: { + body: _t("To continue, please enter your password:"), + }, + }, + }; + const aesthetics = DEACTIVATE_AESTHETICS[stage]; let bodyText = null; let continueText = null; From bc690c8f17f7eff0854757f78b2928cccdc18e2b Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 22 Apr 2020 21:41:30 +0100 Subject: [PATCH 15/18] i18n Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/i18n/strings/en_EN.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 7af45003a8..5634dc8b5b 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1580,12 +1580,12 @@ "You've previously used a newer version of Riot on %(host)s. To use this version again with end to end encryption, you will need to sign out and back in again. ": "You've previously used a newer version of Riot on %(host)s. To use this version again with end to end encryption, you will need to sign out and back in again. ", "Incompatible Database": "Incompatible Database", "Continue With Encryption Disabled": "Continue With Encryption Disabled", + "Server did not require any authentication": "Server did not require any authentication", + "Server did not return valid authentication information.": "Server did not return valid authentication information.", "Confirm your account deactivation by using Single Sign On to prove your identity.": "Confirm your account deactivation by using Single Sign On to prove your identity.", "Are you sure you want to deactivate your account? This is irreversible.": "Are you sure you want to deactivate your account? This is irreversible.", "Confirm account deactivation": "Confirm account deactivation", "To continue, please enter your password:": "To continue, please enter your password:", - "Server did not require any authentication": "Server did not require any authentication", - "Server did not return valid authentication information.": "Server did not return valid authentication information.", "There was a problem communicating with the server. Please try again.": "There was a problem communicating with the server. Please try again.", "This will make your account permanently unusable. You will not be able to log in, and no one will be able to re-register the same user ID. This will cause your account to leave all rooms it is participating in, and it will remove your account details from your identity server. This action is irreversible.": "This will make your account permanently unusable. You will not be able to log in, and no one will be able to re-register the same user ID. This will cause your account to leave all rooms it is participating in, and it will remove your account details from your identity server. This action is irreversible.", "Deactivating your account does not by default cause us to forget messages you have sent. If you would like us to forget your messages, please tick the box below.": "Deactivating your account does not by default cause us to forget messages you have sent. If you would like us to forget your messages, please tick the box below.", From 80b8120bc36bd878575cdbf463092833df16b451 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 22 Apr 2020 22:32:02 +0100 Subject: [PATCH 16/18] Update login security copy and design to match Figma Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- res/css/_components.scss | 1 - .../structures/auth/_CompleteSecurity.scss | 44 +++++++++++++++++++ .../views/elements/_ButtonPlaceholder.scss | 24 ---------- .../structures/auth/CompleteSecurity.js | 4 +- .../structures/auth/SetupEncryptionBody.js | 38 +++++++++------- .../views/elements/ButtonPlaceholder.js | 19 -------- src/i18n/strings/en_EN.json | 8 ++-- 7 files changed, 72 insertions(+), 66 deletions(-) delete mode 100644 res/css/views/elements/_ButtonPlaceholder.scss delete mode 100644 src/components/views/elements/ButtonPlaceholder.js diff --git a/res/css/_components.scss b/res/css/_components.scss index a5dc87a952..0ba2b609e8 100644 --- a/res/css/_components.scss +++ b/res/css/_components.scss @@ -94,7 +94,6 @@ @import "./views/elements/_AccessibleButton.scss"; @import "./views/elements/_AddressSelector.scss"; @import "./views/elements/_AddressTile.scss"; -@import "./views/elements/_ButtonPlaceholder.scss"; @import "./views/elements/_DirectorySearchBox.scss"; @import "./views/elements/_Dropdown.scss"; @import "./views/elements/_EditableItemList.scss"; diff --git a/res/css/structures/auth/_CompleteSecurity.scss b/res/css/structures/auth/_CompleteSecurity.scss index 80e7aaada0..f742be70e4 100644 --- a/res/css/structures/auth/_CompleteSecurity.scss +++ b/res/css/structures/auth/_CompleteSecurity.scss @@ -26,6 +26,50 @@ limitations under the License. position: relative; } +.mx_CompleteSecurity_clients { + width: max-content; + margin: 36px auto 0; + + .mx_CompleteSecurity_clients_desktop, .mx_CompleteSecurity_clients_mobile { + position: relative; + width: 160px; + text-align: center; + padding-top: 64px; + display: inline-block; + + &::before { + content: ''; + position: absolute; + height: 48px; + width: 48px; + left: 56px; + top: 0; + background-color: $muted-fg-color; + mask-repeat: no-repeat; + mask-size: contain; + } + } + + .mx_CompleteSecurity_clients_desktop { + margin-right: 56px; + } + + .mx_CompleteSecurity_clients_desktop::before { + mask-image: url('$(res)/img/feather-customised/monitor.svg'); + } + + .mx_CompleteSecurity_clients_mobile::before { + mask-image: url('$(res)/img/feather-customised/smartphone.svg'); + } + + p { + margin-top: 16px; + font-size: $font-12px; + color: $muted-fg-color; + text-align: center; + } +} + .mx_CompleteSecurity_heroIcon { width: 128px; height: 128px; diff --git a/res/css/views/elements/_ButtonPlaceholder.scss b/res/css/views/elements/_ButtonPlaceholder.scss deleted file mode 100644 index 858fcdecf6..0000000000 --- a/res/css/views/elements/_ButtonPlaceholder.scss +++ /dev/null @@ -1,24 +0,0 @@ -/* -Copyright 2020 The Matrix.org Foundation C.I.C. - -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_ButtonPlaceholder { - font-size: $font-14px; - font-weight: 600; - padding: 7px 18px; - display: inline-block; - text-align: center; - color: $authpage-secondary-color; -} diff --git a/src/components/structures/auth/CompleteSecurity.js b/src/components/structures/auth/CompleteSecurity.js index 95128c0be9..c73691611d 100644 --- a/src/components/structures/auth/CompleteSecurity.js +++ b/src/components/structures/auth/CompleteSecurity.js @@ -60,7 +60,7 @@ export default class CompleteSecurity extends React.Component { if (phase === PHASE_INTRO) { icon = ; - title = _t("Verify this session"); + title = _t("Verify this login"); } else if (phase === PHASE_DONE) { icon = ; title = _t("Session verified"); @@ -69,7 +69,7 @@ export default class CompleteSecurity extends React.Component { title = _t("Are you sure?"); } else if (phase === PHASE_BUSY) { icon = ; - title = _t("Verify this session"); + title = _t("Verify this login"); } else { throw new Error(`Unknown phase ${phase}`); } diff --git a/src/components/structures/auth/SetupEncryptionBody.js b/src/components/structures/auth/SetupEncryptionBody.js index e6302a4685..13fa270a9c 100644 --- a/src/components/structures/auth/SetupEncryptionBody.js +++ b/src/components/structures/auth/SetupEncryptionBody.js @@ -108,31 +108,35 @@ export default class SetupEncryptionBody extends React.Component { member={MatrixClientPeg.get().getUser(this.state.verificationRequest.otherUserId)} />; } else if (phase === PHASE_INTRO) { - const ButtonPlaceholder = sdk.getComponent("elements.ButtonPlaceholder"); return (

{_t( - "Use an existing session to verify this one, " + + "Confirm your identity by verifying this login from one of your other sessions, " + "granting it access to encrypted messages.", )}

{_t( - "If you can’t access one, ", - {}, { - button: sub => - {sub} - , - })}

+ "This requires the latest Riot on your other devices:", + )}

+ +
+
+
Riot Web
+
Riot Desktop
+
+
+
Riot iOS
+
Riot X for Android
+
+

{_t("or another cross-signing capable Matrix client")}

+
+
- + + {_t("Use Recovery Passphrase or Key")} + + {_t("Skip")} - {_t("Use your other device to continue…")}
); @@ -150,7 +154,7 @@ export default class SetupEncryptionBody extends React.Component { } return (
-
+
{message}
{props.children}
; -} diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 7af45003a8..a1eb5928de 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -2067,6 +2067,7 @@ "Uploading %(filename)s and %(count)s others|zero": "Uploading %(filename)s", "Uploading %(filename)s and %(count)s others|one": "Uploading %(filename)s and %(count)s other", "Could not load user profile": "Could not load user profile", + "Verify this login": "Verify this login", "Session verified": "Session verified", "Failed to send email": "Failed to send email", "The email address linked to your account must be entered.": "The email address linked to your account must be entered.", @@ -2120,9 +2121,10 @@ "You can now close this window or log in to your new account.": "You can now close this window or log in to your new account.", "Registration Successful": "Registration Successful", "Create your account": "Create your account", - "Use an existing session to verify this one, granting it access to encrypted messages.": "Use an existing session to verify this one, granting it access to encrypted messages.", - "If you can’t access one, ": "If you can’t access one, ", - "Use your other device to continue…": "Use your other device to continue…", + "Confirm your identity by verifying this login from one of your other sessions, granting it access to encrypted messages.": "Confirm your identity by verifying this login from one of your other sessions, granting it access to encrypted messages.", + "This requires the latest Riot on your other devices:": "This requires the latest Riot on your other devices:", + "or another cross-signing capable Matrix client": "or another cross-signing capable Matrix client", + "Use Recovery Passphrase or Key": "Use Recovery Passphrase or Key", "Your new session is now verified. It has access to your encrypted messages, and other users will see it as trusted.": "Your new session is now verified. It has access to your encrypted messages, and other users will see it as trusted.", "Your new session is now verified. Other users will see it as trusted.": "Your new session is now verified. Other users will see it as trusted.", "Without completing security on this session, it won’t have access to encrypted messages.": "Without completing security on this session, it won’t have access to encrypted messages.", From a06401a83ed3648bf37bb310aabd151f82a08613 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 22 Apr 2020 22:57:00 +0100 Subject: [PATCH 17/18] stage new artifacts Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- res/img/feather-customised/monitor.svg | 5 +++++ res/img/feather-customised/smartphone.svg | 4 ++++ 2 files changed, 9 insertions(+) create mode 100644 res/img/feather-customised/monitor.svg create mode 100644 res/img/feather-customised/smartphone.svg diff --git a/res/img/feather-customised/monitor.svg b/res/img/feather-customised/monitor.svg new file mode 100644 index 0000000000..231811d5a6 --- /dev/null +++ b/res/img/feather-customised/monitor.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/res/img/feather-customised/smartphone.svg b/res/img/feather-customised/smartphone.svg new file mode 100644 index 0000000000..fde78c82e2 --- /dev/null +++ b/res/img/feather-customised/smartphone.svg @@ -0,0 +1,4 @@ + + + + From a332e0c0f4d6179756b6b09b38409fb3df767d5b Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 22 Apr 2020 23:27:33 +0100 Subject: [PATCH 18/18] Fix BigEmoji for replies Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/HtmlUtils.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/HtmlUtils.js b/src/HtmlUtils.js index a58ea25c8a..34e9e55d25 100644 --- a/src/HtmlUtils.js +++ b/src/HtmlUtils.js @@ -446,7 +446,8 @@ export function bodyToHtml(content, highlights, opts={}) { // their username. Permalinks (links in pills) can be any URL // now, so we just check for an HTTP-looking thing. ( - content.formatted_body == undefined || + strippedBody === safeBody || // replies have the html fallbacks, account for that here + content.formatted_body === undefined || (!content.formatted_body.includes("http:") && !content.formatted_body.includes("https:")) );