confirm to close the passphrase dialog if it was done by backgroundClick

as it is easy to do by accident
pull/21833/head
Bruno Windels 2020-02-06 13:11:24 +01:00
parent c44ebef06f
commit 70a4d3415e
1 changed files with 17 additions and 0 deletions

View File

@ -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) {