mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-08 22:18:28 +03:00
Also allow backup PGP keys on server on import #89
This commit is contained in:
parent
83aa65981b
commit
43cbbd51c1
4 changed files with 29 additions and 22 deletions
|
|
@ -117,19 +117,6 @@ export const GnuPGUserStore = new class {
|
|||
return SettingsCapa('GnuPG');
|
||||
}
|
||||
|
||||
importKey(key, callback) {
|
||||
Remote.request('GnupgImportKey',
|
||||
(iError, oData) => {
|
||||
if (oData?.Result/* && (oData.Result.imported || oData.Result.secretimported)*/) {
|
||||
this.loadKeyrings();
|
||||
}
|
||||
callback?.(iError, oData);
|
||||
}, {
|
||||
key: key
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
keyPair.privateKey
|
||||
keyPair.publicKey
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ export class OpenPgpImportPopupView extends AbstractViewPopup {
|
|||
keyErrorMessage: '',
|
||||
|
||||
saveGnuPG: true,
|
||||
saveServer: false
|
||||
saveServer: true
|
||||
});
|
||||
|
||||
this.canGnuPG = GnuPGUserStore.isSupported();
|
||||
|
|
@ -69,9 +69,22 @@ export class OpenPgpImportPopupView extends AbstractViewPopup {
|
|||
match = reg.exec(keyTrimmed);
|
||||
if (match && 0 < count) {
|
||||
if (match[0] && match[1] && match[2] && match[1] === match[2]) {
|
||||
this.saveGnuPG() && GnuPGUserStore.isSupported() && GnuPGUserStore.importKey(this.key(), (iError, oData) => {
|
||||
iError && alert(oData.ErrorMessage);
|
||||
});
|
||||
const GnuPG = this.saveGnuPG() && GnuPGUserStore.isSupported(),
|
||||
backup = this.saveServer();
|
||||
if (GnuPG || backup()) {
|
||||
Remote.request('PgpImportKey',
|
||||
(iError, oData) => {
|
||||
if (GnuPG && oData?.Result/* && (oData.Result.imported || oData.Result.secretimported)*/) {
|
||||
GnuPGUserStore.loadKeyrings();
|
||||
}
|
||||
iError && alert(oData.ErrorMessage);
|
||||
}, {
|
||||
key: this.key(),
|
||||
gnuPG: GnuPG,
|
||||
backup: backup
|
||||
}
|
||||
);
|
||||
}
|
||||
OpenPGPUserStore.isSupported() && OpenPGPUserStore.importKey(this.key());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue