From 8ffe14881e94b0b7b8fc05ce2a650cc8f2c425cf Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 5 Dec 2016 18:33:38 +0000 Subject: [PATCH 1/2] Don't throw an exception entering settings page if end to end encryption is disabled (eg. if you're a guest and the server is too old to support e2e for guests). --- src/components/structures/UserSettings.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index b82f2f5958..c15f58013e 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -338,7 +338,16 @@ module.exports = React.createClass({ }, _renderCryptoInfo: function() { - var client = MatrixClientPeg.get(); + const client = MatrixClientPeg.get(); + if (!client.isCryptoEnabled()) { + return
+

Cryptography

+
+ End-to-end encryption is disabled +
+
; + } + var deviceId = client.deviceId; var identityKey = client.getDeviceEd25519Key() || ""; From 6777e07a41f69697df9e495fb752343daa3b3530 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 5 Dec 2016 20:03:43 +0000 Subject: [PATCH 2/2] Remove device name from crypto section As it was getting it by assuming our device was the first one, which is just not a valid assumption. --- src/components/structures/UserSettings.js | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index c15f58013e..49674957bc 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -339,25 +339,14 @@ module.exports = React.createClass({ _renderCryptoInfo: function() { const client = MatrixClientPeg.get(); - if (!client.isCryptoEnabled()) { - return
-

Cryptography

-
- End-to-end encryption is disabled -
-
; - } + const deviceId = client.deviceId; + const identityKey = client.getDeviceEd25519Key() || ""; - var deviceId = client.deviceId; - var identityKey = client.getDeviceEd25519Key() || ""; - - var myDevice = client.getStoredDevicesForUser(MatrixClientPeg.get().credentials.userId)[0]; return (

Cryptography

    -
  • { myDevice.getDisplayName() }
  • {deviceId}
  • {identityKey}