diff --git a/src/async-components/views/dialogs/keybackup/CreateKeyBackupDialog.js b/src/async-components/views/dialogs/keybackup/CreateKeyBackupDialog.js index 2c54344a30..9ceff69467 100644 --- a/src/async-components/views/dialogs/keybackup/CreateKeyBackupDialog.js +++ b/src/async-components/views/dialogs/keybackup/CreateKeyBackupDialog.js @@ -240,7 +240,6 @@ export default React.createClass({ _renderPhasePassPhrase: function() { const DialogButtons = sdk.getComponent('views.elements.DialogButtons'); - const AccessibleButton = sdk.getComponent('elements.AccessibleButton'); let strengthMeter; let helpText; @@ -265,8 +264,15 @@ export default React.createClass({ } return
-

{_t("Secure your encrypted message history with a Recovery Passphrase.")}

-

{_t("You'll need it if you log out or lose access to this device.")}

+

{_t( + "Warning: you should only set up key backup from a trusted computer.", {}, + { b: sub => {sub} }, + )}

+

{_t( + "We'll store an encrypted copy of your keys on our server. " + + "Protect your backup with a passphrase to keep it secure.", + )}

+

{_t("For maximum security, this should be different from your account password.")}

@@ -291,34 +297,12 @@ export default React.createClass({ disabled={!this._passPhraseIsValid()} /> -

{_t( - "If you don't want encrypted message history to be available on other devices, "+ - ".", - {}, - { - button: sub => - {sub} - , - }, - )}

-

{_t( - "Or, if you don't want to create a Recovery Passphrase, skip this step and "+ - ".", - {}, - { - button: sub => - {sub} - , - }, - )}

+
+ {_t("Advanced")} +

+
; }, @@ -353,9 +337,7 @@ export default React.createClass({ const DialogButtons = sdk.getComponent('views.elements.DialogButtons'); return

{_t( - "Type in your Recovery Passphrase to confirm you remember it. " + - "If it helps, add it to your password manager or store it " + - "somewhere safe.", + "Please enter your passphrase a second time to confirm.", )}

@@ -392,7 +374,13 @@ export default React.createClass({ } return
-

{_t("Make a copy of this Recovery Key and keep it safe.")}

+

{_t( + "Your recovery key is a safety net - you can use it to restore " + + "access to your encrypted messages if you forget your passphrase.", + )}

+

{_t( + "Keep your recovery key somewhere very secure, like a password manager (or a safe)", + )}

{bodyText}

@@ -455,10 +443,9 @@ export default React.createClass({ const DialogButtons = sdk.getComponent('views.elements.DialogButtons'); return

{_t( - "Your encryption keys are now being backed up in the background " + - "to your Homeserver. The initial backup could take several minutes. " + - "You can view key backup upload progress in Settings.")}

- + @@ -484,19 +471,19 @@ export default React.createClass({ _titleForPhase: function(phase) { switch (phase) { case PHASE_PASSPHRASE: - return _t('Create a Recovery Passphrase'); + return _t('Secure your backup with a passphrase'); case PHASE_PASSPHRASE_CONFIRM: - return _t('Confirm Recovery Passphrase'); + return _t('Confirm your passphrase'); case PHASE_OPTOUT_CONFIRM: return _t('Warning!'); case PHASE_SHOWKEY: - return _t('Recovery Key'); + return _t('Recovery key'); case PHASE_KEEPITSAFE: return _t('Keep it safe'); case PHASE_BACKINGUP: return _t('Starting backup...'); case PHASE_DONE: - return _t('Backup Started'); + return _t('Success!'); default: return _t("Create Key Backup"); } diff --git a/src/components/views/dialogs/LogoutDialog.js b/src/components/views/dialogs/LogoutDialog.js index 16b92af1c8..53b9f01da4 100644 --- a/src/components/views/dialogs/LogoutDialog.js +++ b/src/components/views/dialogs/LogoutDialog.js @@ -22,6 +22,10 @@ import { _t } from '../../../languageHandler'; import MatrixClientPeg from '../../../MatrixClientPeg'; export default class LogoutDialog extends React.Component { + defaultProps = { + onFinished: function() {}, + } + constructor() { super(); this._onSettingsLinkClick = this._onSettingsLinkClick.bind(this); @@ -29,13 +33,37 @@ export default class LogoutDialog extends React.Component { this._onFinished = this._onFinished.bind(this); this._onSetRecoveryMethodClick = this._onSetRecoveryMethodClick.bind(this); this._onLogoutConfirm = this._onLogoutConfirm.bind(this); + + this.state = { + loading: false, + backupInfo: null, + error: null, + }; + + if (!MatrixClientPeg.get().getKeyBackupEnabled()) { + this._loadBackupStatus(); + } + } + + async _loadBackupStatus() { + try { + const backupInfo = await MatrixClientPeg.get().getKeyBackupVersion(); + this.setState({ + loading: false, + backupInfo, + }); + } catch (e) { + console.log("Unable to fetch key backup status", e); + this.setState({ + loading: false, + error: e, + }); + } } _onSettingsLinkClick() { // close dialog - if (this.props.onFinished) { - this.props.onFinished(); - } + this.props.onFinished(); } _onExportE2eKeysClicked() { @@ -52,9 +80,7 @@ export default class LogoutDialog extends React.Component { dis.dispatch({action: 'logout'}); } // close dialog - if (this.props.onFinished) { - this.props.onFinished(); - } + this.props.onFinished(); } _onSetRecoveryMethodClick() { @@ -63,72 +89,83 @@ export default class LogoutDialog extends React.Component { ); // close dialog - if (this.props.onFinished) { - this.props.onFinished(); - } + this.props.onFinished(); } _onLogoutConfirm() { dis.dispatch({action: 'logout'}); // close dialog - if (this.props.onFinished) { - this.props.onFinished(); - } + this.props.onFinished(); } render() { const description =

{_t( - "When you log out, you'll lose your secure message history. To prevent " + - "this, set up a recovery method.", - )}

-

{_t( - "Alternatively, advanced users can also manually export encryption keys in " + - "Settings before logging out.", {}, - { - a: sub => {sub}, - }, + "Encrypted messages are secured with end-to-end encryption. " + + "Only you and the recipient(s) have the keys to read these messages.", )}

+

{_t("Back up your keys before signing out to avoid losing them.")}

; if (!MatrixClientPeg.get().getKeyBackupEnabled()) { const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog'); - const DialogButtons = sdk.getComponent('views.elements.DialogButtons'); + + let dialogContent; + if (this.state.loading) { + const Spinner = sdk.getComponent('views.elements.Spinner'); + + dialogContent = ; + } else { + const DialogButtons = sdk.getComponent('views.elements.DialogButtons'); + let setupButtonCaption; + if (this.state.backupInfo) { + setupButtonCaption = _t("Use Key Backup"); + } else { + // if there's an error fetching the backup info, we'll just assume there's + // no backup for the purpose of the button caption + setupButtonCaption = _t("Start using Key Backup"); + } + + dialogContent =
+
+ { description } +
+ + + +
+ {_t("Advanced")} +

+
+
; + } // Not quite a standard question dialog as the primary button cancels // the action and does something else instead, whilst non-default button // confirms the action. return ( -
- { description } -
- - - + {dialogContent}
); } else { const QuestionDialog = sdk.getComponent('views.dialogs.QuestionDialog'); return ( - {_t( +

{_t( + "Warning: you should only set up key backup " + + "from a trusted computer.", {}, + { b: sub => {sub} }, + )}

+

{_t( "Access your secure message history and set up secure " + "messaging by entering your recovery passphrase.", - )}
+ )}

- {_t( +

{_t( + "Warning: you should only set up key backup " + + "from a trusted computer.", {}, + { b: sub => {sub} }, + )}

+

{_t( "Access your secure message history and set up secure " + "messaging by entering your recovery key.", - )}
+ )}

{ + this.setState({notNowClicked: true}); + } + onDontAskAgainClick = () => { // When you choose "Don't ask again" from the room reminder, we show a // dialog to confirm the choice. @@ -104,46 +109,54 @@ export default class RoomRecoveryReminder extends React.PureComponent { } render() { - if (this.state.loading) { + // If there was an error loading just don't display the banner: we'll try again + // next time the user switchs to the room. + if (this.state.error || this.state.loading || this.state.notNowClicked) { return null; } const AccessibleButton = sdk.getComponent("views.elements.AccessibleButton"); - let body; - if (this.state.error) { - body =
- {_t("Unable to load key backup status")} -
; - } else if (this.state.backupInfo) { - // A key backup exists for this account, but we're not using it. - body =
-

{_t( - "Secure Key Backup should be active on all of your devices to avoid " + - "losing access to your encrypted messages.", - )}

-
; + let setupCaption; + if (this.state.backupInfo) { + setupCaption = _t("Use Key Backup"); } else { - body = _t( - "Securely back up your decryption keys to the server to make sure " + - "you'll always be able to read your encrypted messages.", - ); + setupCaption = _t("Start using Key Backup"); } return (
{_t( - "Don't risk losing your encrypted messages!", + "Never lose encrypted messages", )}
-
{body}
+
+

{_t( + "Messages in this room are secured with end-to-end " + + "encryption. Only you and the recipient(s) have the " + + "keys to read these messages.", + )}

+

{_t( + "Securely back up your keys to avoid losing them. " + + "Learn more.", {}, + { + // TODO: We don't have this link yet: this will prevent the translators + // having to re-translate the string when we do. + a: sub => '', + }, + )}

+
- {_t("Activate Secure Key Backup")} + {setupCaption} +

+ { _t("Not now") } +

- { _t("No thanks, I'll download a copy of my decryption keys before I log out") } + { _t("Don't ask me again") }

diff --git a/src/components/views/settings/KeyBackupPanel.js b/src/components/views/settings/KeyBackupPanel.js index fb870938c7..3976196b57 100644 --- a/src/components/views/settings/KeyBackupPanel.js +++ b/src/components/views/settings/KeyBackupPanel.js @@ -111,10 +111,10 @@ export default class KeyBackupPanel extends React.PureComponent { Modal.createTrackedDialog('Delete Backup', '', QuestionDialog, { title: _t('Delete Backup'), description: _t( - "Delete your backed up encryption keys from the server? " + - "You will no longer be able to use your recovery key to read encrypted message history", + "Are you sure? You will lose your encrypted messages if your " + + "keys are not backed up properly.", ), - button: _t('Delete backup'), + button: _t('Delete Backup'), danger: true, onFinished: (proceed) => { if (!proceed) return; @@ -135,6 +135,10 @@ export default class KeyBackupPanel extends React.PureComponent { render() { const Spinner = sdk.getComponent("elements.Spinner"); const AccessibleButton = sdk.getComponent("elements.AccessibleButton"); + const encryptedMessageAreEncrypted = _t( + "Encrypted messages are secured with end-to-end encryption. " + + "Only you and the recipient(s) have the keys to read these messages.", + ); if (this.state.error) { return ( @@ -145,14 +149,25 @@ export default class KeyBackupPanel extends React.PureComponent { } else if (this.state.loading) { return ; } else if (this.state.backupInfo) { + const EmojiText = sdk.getComponent('elements.EmojiText'); let clientBackupStatus; + let restoreButtonCaption = _t("Restore from Backup"); + if (MatrixClientPeg.get().getKeyBackupEnabled()) { - clientBackupStatus = _t("This device is using key backup"); + clientBackupStatus =
+

{encryptedMessageAreEncrypted}

+

{_t("This device is backing up your keys. ")}

+
; } else { - clientBackupStatus = _t( - "This device is not using key backup. Restore the backup to start using it.", {}, - {b: x => {x}}, - ); + clientBackupStatus =
+

{encryptedMessageAreEncrypted}

+

{_t( + "This device is not backing up your keys.", {}, + {b: sub => {sub}}, + )}

+

{_t("Back up your keys before signing out to avoid losing them.")}

+
; + restoreButtonCaption = _t("Use key backup"); } let uploadStatus; @@ -243,18 +258,25 @@ export default class KeyBackupPanel extends React.PureComponent {

- { _t("Restore backup") } + {restoreButtonCaption}     - { _t("Delete backup") } + { _t("Delete Backup") }

; } else { return
- {_t("No backup is present")}

+
+

{_t( + "Your keys are not being backed up from this device.", {}, + {b: sub => {sub}}, + )}

+

{encryptedMessageAreEncrypted}

+

{_t("Back up your keys before signing out to avoid losing them.")}

+
- { _t("Start a new backup") } + { _t("Start using Key Backup") }
; } diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 3cc6e71436..def08110a1 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -439,11 +439,14 @@ "Disable Notifications": "Disable Notifications", "Enable Notifications": "Enable Notifications", "Delete Backup": "Delete Backup", - "Delete your backed up encryption keys from the server? You will no longer be able to use your recovery key to read encrypted message history": "Delete your backed up encryption keys from the server? You will no longer be able to use your recovery key to read encrypted message history", - "Delete backup": "Delete backup", + "Are you sure? You will lose your encrypted messages if your keys are not backed up properly.": "Are you sure? You will lose your encrypted messages if your keys are not backed up properly.", + "Encrypted messages are secured with end-to-end encryption. Only you and the recipient(s) have the keys to read these messages.": "Encrypted messages are secured with end-to-end encryption. Only you and the recipient(s) have the keys to read these messages.", "Unable to load key backup status": "Unable to load key backup status", - "This device is using key backup": "This device is using key backup", - "This device is not using key backup. Restore the backup to start using it.": "This device is not using key backup. Restore the backup to start using it.", + "Restore from Backup": "Restore from Backup", + "This device is backing up your keys. ": "This device is backing up your keys. ", + "This device is not backing up your keys.": "This device is not backing up your keys.", + "Back up your keys before signing out to avoid losing them.": "Back up your keys before signing out to avoid losing them.", + "Use key backup": "Use key backup", "Backing up %(sessionsRemaining)s keys...": "Backing up %(sessionsRemaining)s keys...", "All keys backed up": "All keys backed up", "Backup has a signature from unknown device with ID %(deviceId)s.": "Backup has a signature from unknown device with ID %(deviceId)s.", @@ -457,9 +460,8 @@ "Advanced": "Advanced", "Backup version: ": "Backup version: ", "Algorithm: ": "Algorithm: ", - "Restore backup": "Restore backup", - "No backup is present": "No backup is present", - "Start a new backup": "Start a new backup", + "Your keys are not being backed up from this device.": "Your keys are not being backed up from this device.", + "Start using Key Backup": "Start using Key Backup", "Error saving email notification preferences": "Error saving email notification preferences", "An error occurred whilst saving your email notification preferences.": "An error occurred whilst saving your email notification preferences.", "Keywords": "Keywords", @@ -785,11 +787,12 @@ "You are trying to access a room.": "You are trying to access a room.", "Click here to join the discussion!": "Click here to join the discussion!", "This is a preview of this room. Room interactions have been disabled": "This is a preview of this room. Room interactions have been disabled", - "Secure Key Backup should be active on all of your devices to avoid losing access to your encrypted messages.": "Secure Key Backup should be active on all of your devices to avoid losing access to your encrypted messages.", - "Securely back up your decryption keys to the server to make sure you'll always be able to read your encrypted messages.": "Securely back up your decryption keys to the server to make sure you'll always be able to read your encrypted messages.", - "Don't risk losing your encrypted messages!": "Don't risk losing your encrypted messages!", - "Activate Secure Key Backup": "Activate Secure Key Backup", - "No thanks, I'll download a copy of my decryption keys before I log out": "No thanks, I'll download a copy of my decryption keys before I log out", + "Use Key Backup": "Use Key Backup", + "Never lose encrypted messages": "Never lose encrypted messages", + "Messages in this room are secured with end-to-end encryption. Only you and the recipient(s) have the keys to read these messages.": "Messages in this room are secured with end-to-end encryption. Only you and the recipient(s) have the keys to read these messages.", + "Securely back up your keys to avoid losing them. Learn more.": "Securely back up your keys to avoid losing them. Learn more.", + "Not now": "Not now", + "Don't ask me again": "Don't ask me again", "Add a topic": "Add a topic", "This room is using an unstable room version. If you aren't expecting this, please upgrade the room.": "This room is using an unstable room version. If you aren't expecting this, please upgrade the room.", "Click here to upgrade to the latest room version.": "Click here to upgrade to the latest room version.", @@ -1101,11 +1104,10 @@ "Clear cache and resync": "Clear cache and resync", "Riot now uses 3-5x less memory, by only loading information about other users when needed. Please wait whilst we resynchronise with the server!": "Riot now uses 3-5x less memory, by only loading information about other users when needed. Please wait whilst we resynchronise with the server!", "Updating Riot": "Updating Riot", - "When you log out, you'll lose your secure message history. To prevent this, set up a recovery method.": "When you log out, you'll lose your secure message history. To prevent this, set up a recovery method.", - "Alternatively, advanced users can also manually export encryption keys in Settings before logging out.": "Alternatively, advanced users can also manually export encryption keys in Settings before logging out.", - "Set a Recovery Method": "Set a Recovery Method", - "I understand, log out without": "I understand, log out without", - "When signing in again, you can access encrypted chat history by restoring your key backup. You'll need your recovery passphrase or, if you didn't set a recovery passphrase, your recovery key (that you downloaded).": "When signing in again, you can access encrypted chat history by restoring your key backup. You'll need your recovery passphrase or, if you didn't set a recovery passphrase, your recovery key (that you downloaded).", + "I don't want my encrypted messages": "I don't want my encrypted messages", + "Manually export keys": "Manually export keys", + "You'll lose access to your encrypted messages": "You'll lose access to your encrypted messages", + "Are you sure you want to sign out?": "Are you sure you want to sign out?", "Thanks for testing the Riot Redesign. If you run into any bugs or visual issues, please let us know on GitHub.": "Thanks for testing the Riot Redesign. If you run into any bugs or visual issues, please let us know on GitHub.", "To help avoid duplicate issues, please view existing issues first (and add a +1) or create a new issue if you can't find it.": "To help avoid duplicate issues, please view existing issues first (and add a +1) or create a new issue if you can't find it.", "Report bugs & give feedback": "Report bugs & give feedback", @@ -1172,6 +1174,7 @@ "Failed to decrypt %(failedCount)s sessions!": "Failed to decrypt %(failedCount)s sessions!", "Restored %(sessionCount)s session keys": "Restored %(sessionCount)s session keys", "Enter Recovery Passphrase": "Enter Recovery Passphrase", + "Warning: you should only set up key backup from a trusted computer.": "Warning: you should only set up key backup from a trusted computer.", "Access your secure message history and set up secure messaging by entering your recovery passphrase.": "Access your secure message history and set up secure messaging by entering your recovery passphrase.", "Next": "Next", "If you've forgotten your recovery passphrase you can use your recovery key or set up new recovery options": "If you've forgotten your recovery passphrase you can use your recovery key or set up new recovery options", @@ -1488,19 +1491,19 @@ "Import": "Import", "Great! This passphrase looks strong enough.": "Great! This passphrase looks strong enough.", "Keep going...": "Keep going...", - "Secure your encrypted message history with a Recovery Passphrase.": "Secure your encrypted message history with a Recovery Passphrase.", - "You'll need it if you log out or lose access to this device.": "You'll need it if you log out or lose access to this device.", + "We'll store an encrypted copy of your keys on our server. Protect your backup with a passphrase to keep it secure.": "We'll store an encrypted copy of your keys on our server. Protect your backup with a passphrase to keep it secure.", + "For maximum security, this should be different from your account password.": "For maximum security, this should be different from your account password.", "Enter a passphrase...": "Enter a passphrase...", - "If you don't want encrypted message history to be available on other devices, .": "If you don't want encrypted message history to be available on other devices, .", - "Or, if you don't want to create a Recovery Passphrase, skip this step and .": "Or, if you don't want to create a Recovery Passphrase, skip this step and .", + "Set up with a Recovery Key": "Set up with a Recovery Key", "That matches!": "That matches!", "That doesn't match.": "That doesn't match.", "Go back to set it again.": "Go back to set it again.", - "Type in your Recovery Passphrase to confirm you remember it. If it helps, add it to your password manager or store it somewhere safe.": "Type in your Recovery Passphrase to confirm you remember it. If it helps, add it to your password manager or store it somewhere safe.", + "Please enter your passphrase a second time to confirm.": "Please enter your passphrase a second time to confirm.", "Repeat your passphrase...": "Repeat your passphrase...", "As a safety net, you can use it to restore your encrypted message history if you forget your Recovery Passphrase.": "As a safety net, you can use it to restore your encrypted message history if you forget your Recovery Passphrase.", "As a safety net, you can use it to restore your encrypted message history.": "As a safety net, you can use it to restore your encrypted message history.", - "Make a copy of this Recovery Key and keep it safe.": "Make a copy of this Recovery Key and keep it safe.", + "Your recovery key is a safety net - you can use it to restore access to your encrypted messages if you forget your passphrase.": "Your recovery key is a safety net - you can use it to restore access to your encrypted messages if you forget your passphrase.", + "Keep your recovery key somewhere very secure, like a password manager (or a safe)": "Keep your recovery key somewhere very secure, like a password manager (or a safe)", "Your Recovery Key": "Your Recovery Key", "Copy to clipboard": "Copy to clipboard", "Download": "Download", @@ -1509,15 +1512,16 @@ "Print it and store it somewhere safe": "Print it and store it somewhere safe", "Save it on a USB key or backup drive": "Save it on a USB key or backup drive", "Copy it to your personal cloud storage": "Copy it to your personal cloud storage", - "Your encryption keys are now being backed up in the background to your Homeserver. The initial backup could take several minutes. You can view key backup upload progress in Settings.": "Your encryption keys are now being backed up in the background to your Homeserver. The initial backup could take several minutes. You can view key backup upload progress in Settings.", + "Your keys are being backed up (the first backup could take a few minutes).": "Your keys are being backed up (the first backup could take a few minutes).", + "Okay": "Okay", "Without setting up Secure Message Recovery, you won't be able to restore your encrypted message history if you log out or use another device.": "Without setting up Secure Message Recovery, you won't be able to restore your encrypted message history if you log out or use another device.", "Set up Secure Message Recovery": "Set up Secure Message Recovery", - "Create a Recovery Passphrase": "Create a Recovery Passphrase", - "Confirm Recovery Passphrase": "Confirm Recovery Passphrase", - "Recovery Key": "Recovery Key", + "Secure your backup with a passphrase": "Secure your backup with a passphrase", + "Confirm your passphrase": "Confirm your passphrase", + "Recovery key": "Recovery key", "Keep it safe": "Keep it safe", "Starting backup...": "Starting backup...", - "Backup Started": "Backup Started", + "Success!": "Success!", "Create Key Backup": "Create Key Backup", "Unable to create key backup": "Unable to create key backup", "Retry": "Retry",