mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-11-10 17:13:38 +08:00
Replace AskPopupView "Yes" button with "Sign" or "Decrypt"
This commit is contained in:
parent
66a3a18f67
commit
8428838a8b
3 changed files with 11 additions and 10 deletions
|
@ -14,8 +14,8 @@ import { OpenPgpKeyPopupView } from 'View/Popup/OpenPgpKey';
|
|||
import { AskPopupView } from 'View/Popup/Ask';
|
||||
|
||||
const
|
||||
askPassphrase = async privateKey =>
|
||||
await AskPopupView.password('GnuPG key<br>' + privateKey.id + ' ' + privateKey.emails[0]),
|
||||
askPassphrase = async (privateKey, btnTxt = 'LABEL_SIGN') =>
|
||||
await AskPopupView.password('GnuPG key<br>' + privateKey.id + ' ' + privateKey.emails[0], 'OPENPGP/'+btnTxt),
|
||||
|
||||
findGnuPGKey = (keys, query, sign) =>
|
||||
keys.find(key =>
|
||||
|
@ -173,7 +173,7 @@ export const GnuPGUserStore = new class {
|
|||
Uid: message.uid,
|
||||
PartId: pgpInfo.PartId,
|
||||
KeyId: key.id,
|
||||
Passphrase: await askPassphrase(key),
|
||||
Passphrase: await askPassphrase(key, 'BUTTON_DECRYPT'),
|
||||
Data: '' // message.plain() optional
|
||||
}
|
||||
if (null !== params.Passphrase) {
|
||||
|
|
|
@ -19,8 +19,8 @@ const
|
|||
key.emails.includes(query) || query == key.id || query == key.fingerprint
|
||||
),
|
||||
|
||||
askPassphrase = async privateKey =>
|
||||
await AskPopupView.password('OpenPGP.js key<br>' + privateKey.id + ' ' + privateKey.emails[0]),
|
||||
askPassphrase = async (privateKey, btnTxt = 'LABEL_SIGN') =>
|
||||
await AskPopupView.password('OpenPGP.js key<br>' + privateKey.id + ' ' + privateKey.emails[0], 'OPENPGP/'+btnTxt),
|
||||
|
||||
/**
|
||||
* OpenPGP.js v5 removed the localStorage (keyring)
|
||||
|
@ -184,7 +184,7 @@ export const OpenPGPUserStore = new class {
|
|||
}
|
||||
}
|
||||
if (privateKey) try {
|
||||
const passphrase = await askPassphrase(privateKey);
|
||||
const passphrase = await askPassphrase(privateKey, 'BUTTON_DECRYPT');
|
||||
|
||||
if (null !== passphrase) {
|
||||
const
|
||||
|
|
|
@ -42,11 +42,11 @@ class AskPopupView extends AbstractViewPopup {
|
|||
* @param {boolean=} focusOnShow = true
|
||||
* @returns {void}
|
||||
*/
|
||||
onShow(sAskDesc, fYesFunc = null, fNoFunc = null, focusOnShow = true, askPass = false) {
|
||||
onShow(sAskDesc, fYesFunc = null, fNoFunc = null, focusOnShow = true, askPass = false, btnText = '') {
|
||||
this.askDesc(sAskDesc || '');
|
||||
this.askPass(askPass);
|
||||
this.passphrase('');
|
||||
this.yesButton(i18n('POPUPS_ASK/BUTTON_YES'));
|
||||
this.yesButton(i18n(btnText || 'POPUPS_ASK/BUTTON_YES'));
|
||||
this.noButton(i18n(askPass ? 'GLOBAL/CANCEL' : 'POPUPS_ASK/BUTTON_NO'));
|
||||
this.fYesAction = fYesFunc;
|
||||
this.fNoAction = fNoFunc;
|
||||
|
@ -75,14 +75,15 @@ class AskPopupView extends AbstractViewPopup {
|
|||
}
|
||||
}
|
||||
|
||||
AskPopupView.password = function(sAskDesc) {
|
||||
AskPopupView.password = function(sAskDesc, btnText) {
|
||||
return new Promise(resolve => {
|
||||
this.showModal([
|
||||
sAskDesc,
|
||||
() => resolve(this.__vm.passphrase()),
|
||||
() => resolve(null),
|
||||
true,
|
||||
true
|
||||
true,
|
||||
btnText
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue