From 658e88c30f5521c087f63be5b1e132522e92fdab Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Tue, 22 May 2018 15:47:31 +0100 Subject: [PATCH] Implement consent/terms and conditions dialog for /_matrix/consent flow --- src/components/structures/MatrixChat.js | 22 ++++++++++++++++++++++ src/i18n/strings/en_EN.json | 3 +++ 2 files changed, 25 insertions(+) diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index 91d5ee8970..96e721f7ca 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -1232,6 +1232,28 @@ export default React.createClass({ action: 'logout', }); }); + cli.on('no_consent', function(message, consentUri) { + const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog"); + Modal.createTrackedDialog('No Consent Dialog', '', QuestionDialog, { + title: _t('Terms and Conditions'), + description:
+

{ _t( + 'To continue using the %(homeserverDomain)s homeserver ' + + 'you must review and agree to our terms and conditions.', + { homeserverDomain: cli.getDomain() }, + ) } +

+
, + button: _t('Review terms and conditions'), + cancelButton: _t('Dismiss'), + onFinished: (confirmed) => { + if (confirmed) { + window.open(consentUri, '_blank'); + } + }, + }, null, true); + }); + cli.on("accountData", function(ev) { if (ev.getType() === 'im.vector.web.settings') { if (ev.getContent() && ev.getContent().theme) { diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 239b45c32e..f3e3d6b097 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -943,6 +943,9 @@ "Failed to leave room": "Failed to leave room", "Signed Out": "Signed Out", "For security, this session has been signed out. Please sign in again.": "For security, this session has been signed out. Please sign in again.", + "Terms and Conditions": "Terms and Conditions", + "To continue using the %(homeserverDomain)s homeserver you must review and agree to our terms and conditions.": "To continue using the %(homeserverDomain)s homeserver you must review and agree to our terms and conditions.", + "Review terms and conditions": "Review terms and conditions", "Old cryptography data detected": "Old cryptography data detected", "Data from an older version of Riot has been detected. This will have caused end-to-end cryptography to malfunction in the older version. End-to-end encrypted messages exchanged recently whilst using the older version may not be decryptable in this version. This may also cause messages exchanged with this version to fail. If you experience problems, log out and back in again. To retain message history, export and re-import your keys.": "Data from an older version of Riot has been detected. This will have caused end-to-end cryptography to malfunction in the older version. End-to-end encrypted messages exchanged recently whilst using the older version may not be decryptable in this version. This may also cause messages exchanged with this version to fail. If you experience problems, log out and back in again. To retain message history, export and re-import your keys.", "Logout": "Logout",