Merge pull request #4038 from matrix-org/bwindels/4sunlockpurpose

Differentiate AccessSecretStorageDialog dismiss dialog based on which key we want to read
This commit is contained in:
Bruno Windels 2020-02-07 08:58:53 +00:00 committed by GitHub
commit 720450f372
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 12 deletions

View file

@ -43,7 +43,28 @@ export class AccessCancelledError extends Error {
}
}
async function getSecretStorageKey({ keys: keyInfos }) {
async function confirmToDismiss(name) {
let description;
if (name === "m.cross_signing.user_signing") {
description = _t("If you cancel now, you won't complete verifying the other user.");
} else if (name === "m.cross_signing.self_signing") {
description = _t("If you cancel now, you won't complete verifying your other session.");
} else {
description = _t("If you cancel now, you won't complete your secret storage operation.");
}
const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
const [sure] = await Modal.createDialog(QuestionDialog, {
title: _t("Cancel entering passphrase?"),
description,
danger: true,
cancelButton: _t("Enter passphrase"),
button: _t("Cancel"),
}).finished;
return sure;
}
async function getSecretStorageKey({ keys: keyInfos }, ssssItemName) {
const keyInfoEntries = Object.entries(keyInfos);
if (keyInfoEntries.length > 1) {
throw new Error("Multiple storage key requests not implemented");
@ -83,15 +104,10 @@ async function getSecretStorageKey({ keys: keyInfos }) {
/* isStaticModal= */ false,
/* options= */ {
onBeforeClose: async (reason) => {
if (reason !== "backgroundClick") {
return true;
if (reason === "backgroundClick") {
return confirmToDismiss(ssssItemName);
}
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 secret storage operation!"),
}).finished;
return sure;
return true;
},
},
);

View file

@ -60,8 +60,12 @@
"Server may be unavailable, overloaded, or you hit a bug.": "Server may be unavailable, overloaded, or you hit a bug.",
"The server does not support the room version specified.": "The server does not support the room version specified.",
"Failure to create room": "Failure to create room",
"If you cancel now, you won't complete verifying the other user.": "If you cancel now, you won't complete verifying the other user.",
"If you cancel now, you won't complete verifying your other session.": "If you cancel now, you won't complete verifying your other session.",
"If you cancel now, you won't complete your secret storage operation.": "If you cancel now, you won't complete your secret storage operation.",
"Cancel entering passphrase?": "Cancel entering passphrase?",
"If you cancel now, you won't complete your secret storage operation!": "If you cancel now, you won't complete your secret storage operation!",
"Enter passphrase": "Enter passphrase",
"Cancel": "Cancel",
"Setting up keys": "Setting up keys",
"Send anyway": "Send anyway",
"Send": "Send",
@ -452,7 +456,6 @@
"Verify this device by confirming the following number appears on its screen.": "Verify this device by confirming the following number appears on its screen.",
"Verify this user by confirming the following number appears on their screen.": "Verify this user by confirming the following number appears on their screen.",
"Unable to find a supported verification method.": "Unable to find a supported verification method.",
"Cancel": "Cancel",
"Waiting for %(displayName)s to verify…": "Waiting for %(displayName)s to verify…",
"They match": "They match",
"They don't match": "They don't match",
@ -2022,7 +2025,6 @@
"Export room keys": "Export room keys",
"This process allows you to export the keys for messages you have received in encrypted rooms to a local file. You will then be able to import the file into another Matrix client in the future, so that client will also be able to decrypt these messages.": "This process allows you to export the keys for messages you have received in encrypted rooms to a local file. You will then be able to import the file into another Matrix client in the future, so that client will also be able to decrypt these messages.",
"The exported file will allow anyone who can read it to decrypt any encrypted messages that you can see, so you should be careful to keep it secure. To help with this, you should enter a passphrase below, which will be used to encrypt the exported data. It will only be possible to import the data by using the same passphrase.": "The exported file will allow anyone who can read it to decrypt any encrypted messages that you can see, so you should be careful to keep it secure. To help with this, you should enter a passphrase below, which will be used to encrypt the exported data. It will only be possible to import the data by using the same passphrase.",
"Enter passphrase": "Enter passphrase",
"Confirm passphrase": "Confirm passphrase",
"Export": "Export",
"Import room keys": "Import room keys",