mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-02 05:59:21 +03:00
Added Import S/MIME certificate popup
And much better handling of the sign and encrypt options
This commit is contained in:
parent
f94fc34d4f
commit
6f33bc23d3
47 changed files with 375 additions and 227 deletions
50
dev/View/Popup/SMimeImport.js
Normal file
50
dev/View/Popup/SMimeImport.js
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
import { addObservablesTo } from 'External/ko';
|
||||
import { getNotification } from 'Common/Translator';
|
||||
|
||||
import { AbstractViewPopup } from 'Knoin/AbstractViews';
|
||||
|
||||
import Remote from 'Remote/User/Fetch';
|
||||
|
||||
export class SMimeImportPopupView extends AbstractViewPopup {
|
||||
constructor() {
|
||||
super('SMimeImport');
|
||||
|
||||
addObservablesTo(this, {
|
||||
pem: '',
|
||||
pemError: false,
|
||||
pemErrorMessage: '',
|
||||
pemValid: false
|
||||
});
|
||||
|
||||
this.pem.subscribe(value => {
|
||||
this.pemError(false);
|
||||
this.pemErrorMessage('');
|
||||
this.pemValid(value && value.includes('-----BEGIN CERTIFICATE-----'));
|
||||
});
|
||||
}
|
||||
|
||||
submitForm() {
|
||||
if (this.pemValid()) {
|
||||
Remote.request('SMimeImportCertificate',
|
||||
(iError, oData) => {
|
||||
if (iError) {
|
||||
this.pemError(true);
|
||||
this.pemErrorMessage(getNotification(iError, oData?.ErrorMessage));
|
||||
// oData?.ErrorMessageAdditional;
|
||||
} else {
|
||||
this.close();
|
||||
}
|
||||
},
|
||||
{pem:this.pem()}
|
||||
);
|
||||
} else {
|
||||
this.pemError(true);
|
||||
}
|
||||
}
|
||||
|
||||
onShow() {
|
||||
this.pem('');
|
||||
this.pemError(false);
|
||||
this.pemErrorMessage('');
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue