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

as it is easy to do by accident
This commit is contained in:
Bruno Windels 2020-02-06 13:11:24 +01:00
parent c44ebef06f
commit 70a4d3415e

View file

@ -70,6 +70,7 @@ async function getSecretStorageKey({ keys: keyInfos }) {
sdk.getComponent("dialogs.secretstorage.AccessSecretStorageDialog"); sdk.getComponent("dialogs.secretstorage.AccessSecretStorageDialog");
const { finished } = Modal.createTrackedDialog("Access Secret Storage dialog", "", const { finished } = Modal.createTrackedDialog("Access Secret Storage dialog", "",
AccessSecretStorageDialog, AccessSecretStorageDialog,
/* props= */
{ {
keyInfo: info, keyInfo: info,
checkPrivateKey: async (input) => { checkPrivateKey: async (input) => {
@ -77,6 +78,22 @@ async function getSecretStorageKey({ keys: keyInfos }) {
return MatrixClientPeg.get().checkSecretStoragePrivateKey(key, info.pubkey); 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; const [input] = await finished;
if (!input) { if (!input) {