mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03: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';
|
import { AskPopupView } from 'View/Popup/Ask';
|
||||||
|
|
||||||
const
|
const
|
||||||
askPassphrase = async privateKey =>
|
askPassphrase = async (privateKey, btnTxt = 'LABEL_SIGN') =>
|
||||||
await AskPopupView.password('GnuPG key<br>' + privateKey.id + ' ' + privateKey.emails[0]),
|
await AskPopupView.password('GnuPG key<br>' + privateKey.id + ' ' + privateKey.emails[0], 'OPENPGP/'+btnTxt),
|
||||||
|
|
||||||
findGnuPGKey = (keys, query, sign) =>
|
findGnuPGKey = (keys, query, sign) =>
|
||||||
keys.find(key =>
|
keys.find(key =>
|
||||||
|
|
@ -173,7 +173,7 @@ export const GnuPGUserStore = new class {
|
||||||
Uid: message.uid,
|
Uid: message.uid,
|
||||||
PartId: pgpInfo.PartId,
|
PartId: pgpInfo.PartId,
|
||||||
KeyId: key.id,
|
KeyId: key.id,
|
||||||
Passphrase: await askPassphrase(key),
|
Passphrase: await askPassphrase(key, 'BUTTON_DECRYPT'),
|
||||||
Data: '' // message.plain() optional
|
Data: '' // message.plain() optional
|
||||||
}
|
}
|
||||||
if (null !== params.Passphrase) {
|
if (null !== params.Passphrase) {
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@ const
|
||||||
key.emails.includes(query) || query == key.id || query == key.fingerprint
|
key.emails.includes(query) || query == key.id || query == key.fingerprint
|
||||||
),
|
),
|
||||||
|
|
||||||
askPassphrase = async privateKey =>
|
askPassphrase = async (privateKey, btnTxt = 'LABEL_SIGN') =>
|
||||||
await AskPopupView.password('OpenPGP.js key<br>' + privateKey.id + ' ' + privateKey.emails[0]),
|
await AskPopupView.password('OpenPGP.js key<br>' + privateKey.id + ' ' + privateKey.emails[0], 'OPENPGP/'+btnTxt),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OpenPGP.js v5 removed the localStorage (keyring)
|
* OpenPGP.js v5 removed the localStorage (keyring)
|
||||||
|
|
@ -184,7 +184,7 @@ export const OpenPGPUserStore = new class {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (privateKey) try {
|
if (privateKey) try {
|
||||||
const passphrase = await askPassphrase(privateKey);
|
const passphrase = await askPassphrase(privateKey, 'BUTTON_DECRYPT');
|
||||||
|
|
||||||
if (null !== passphrase) {
|
if (null !== passphrase) {
|
||||||
const
|
const
|
||||||
|
|
|
||||||
|
|
@ -42,11 +42,11 @@ class AskPopupView extends AbstractViewPopup {
|
||||||
* @param {boolean=} focusOnShow = true
|
* @param {boolean=} focusOnShow = true
|
||||||
* @returns {void}
|
* @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.askDesc(sAskDesc || '');
|
||||||
this.askPass(askPass);
|
this.askPass(askPass);
|
||||||
this.passphrase('');
|
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.noButton(i18n(askPass ? 'GLOBAL/CANCEL' : 'POPUPS_ASK/BUTTON_NO'));
|
||||||
this.fYesAction = fYesFunc;
|
this.fYesAction = fYesFunc;
|
||||||
this.fNoAction = fNoFunc;
|
this.fNoAction = fNoFunc;
|
||||||
|
|
@ -75,14 +75,15 @@ class AskPopupView extends AbstractViewPopup {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AskPopupView.password = function(sAskDesc) {
|
AskPopupView.password = function(sAskDesc, btnText) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
this.showModal([
|
this.showModal([
|
||||||
sAskDesc,
|
sAskDesc,
|
||||||
() => resolve(this.__vm.passphrase()),
|
() => resolve(this.__vm.passphrase()),
|
||||||
() => resolve(null),
|
() => resolve(null),
|
||||||
true,
|
true,
|
||||||
true
|
true,
|
||||||
|
btnText
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue