Ask password to generate S/MIME self signed #259

This commit is contained in:
the-djmaze 2024-02-20 01:01:15 +01:00
parent 3f08051e37
commit 568caed3c7
43 changed files with 147 additions and 62 deletions

View file

@ -14,6 +14,8 @@ import { folderListOptionsBuilder } from 'Common/Folders';
import { i18n } from 'Common/Translator';
import { defaultOptionsAfterRender } from 'Common/Utils';
import { AskPopupView } from 'View/Popup/Ask';
export class IdentityPopupView extends AbstractViewPopup {
constructor() {
super('Identity');
@ -42,16 +44,21 @@ export class IdentityPopupView extends AbstractViewPopup {
this.createSelfSigned = this.createSelfSigned.bind(this);
}
createSelfSigned() {
let identity = this.identity();
Remote.request('SMimeCreateCertificate', (iError, oData) => {
if (oData.Result.x509) {
identity.smimeKey(oData.Result.pkey);
identity.smimeCertificate(oData.Result.x509);
}
}, {
email: identity.email()
});
async createSelfSigned() {
const identity = this.identity(),
pass = await AskPopupView.password('', 'CRYPTO/CREATE_SELF_SIGNED');
if (pass) {
Remote.request('SMimeCreateCertificate', (iError, oData) => {
if (oData.Result.x509) {
identity.smimeKey(oData.Result.pkey);
identity.smimeCertificate(oData.Result.x509);
}
}, {
name: identity.name(),
email: identity.email(),
passphrase: pass.password
});
}
}
submitForm(form) {