From 70a4d3415eae1356fc3d3228a5a5d9e054264b4e Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 6 Feb 2020 13:11:24 +0100 Subject: [PATCH] confirm to close the passphrase dialog if it was done by backgroundClick as it is easy to do by accident --- src/CrossSigningManager.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/CrossSigningManager.js b/src/CrossSigningManager.js index a560c956f1..8feb651ea5 100644 --- a/src/CrossSigningManager.js +++ b/src/CrossSigningManager.js @@ -70,6 +70,7 @@ async function getSecretStorageKey({ keys: keyInfos }) { sdk.getComponent("dialogs.secretstorage.AccessSecretStorageDialog"); const { finished } = Modal.createTrackedDialog("Access Secret Storage dialog", "", AccessSecretStorageDialog, + /* props= */ { keyInfo: info, checkPrivateKey: async (input) => { @@ -77,6 +78,22 @@ async function getSecretStorageKey({ keys: keyInfos }) { return MatrixClientPeg.get().checkSecretStoragePrivateKey(key, info.pubkey); }, }, + /* className= */ null, + /* isPriorityModal= */ false, + /* isStaticModal= */ false, + /* options= */ { + onBeforeClose: async (reason) => { + if (reason !== "backgroundClick") { + return true; + } + const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog"); + const [sure] = await Modal.createDialog(QuestionDialog, { + title: _t("Cancel entering passphrase?"), + description: _t("If you cancel now, you won't complete your SSSS operation!"), + }).finished; + return sure; + }, + }, ); const [input] = await finished; if (!input) {