mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-04 12:58:50 +00:00
fix(addressbook(web)): update card on save when certificate is removed
This commit is contained in:
@@ -186,7 +186,11 @@
|
||||
|
||||
- (WOResponse *) removeCertificateAction
|
||||
{
|
||||
[[[self clientObject] vCard] setCertificate: nil];
|
||||
SOGoContactGCSEntry *contact;
|
||||
|
||||
contact = [self clientObject];
|
||||
[[contact vCard] setCertificate: nil];
|
||||
[contact save];
|
||||
|
||||
return [self responseWith204];
|
||||
}
|
||||
|
||||
@@ -240,6 +240,7 @@ static Class SOGoContactGCSEntryK = Nil;
|
||||
NSCalendarDate *date;
|
||||
CardElement *element;
|
||||
id o;
|
||||
BOOL hasCertificate;
|
||||
|
||||
unsigned int i, year, month, day;
|
||||
|
||||
@@ -418,6 +419,10 @@ static Class SOGoContactGCSEntryK = Nil;
|
||||
}
|
||||
}
|
||||
|
||||
hasCertificate = [[attributes objectForKey: @"hasCertificate"] boolValue];
|
||||
if (!hasCertificate)
|
||||
[card setCertificate: nil];
|
||||
|
||||
[card cleanupEmptyChildren];
|
||||
}
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@
|
||||
{{::'S/MIME Certificate' | loc}}
|
||||
</p>
|
||||
<md-button class="md-warn"
|
||||
ng-click="editor.card.$removeCertificate()">
|
||||
ng-click="editor.removeCertificate(contactForm)">
|
||||
<var:string label:value="Uninstall"/>
|
||||
</md-button>
|
||||
<md-icon class="sg-icon-toggle">expand_more</md-icon>
|
||||
@@ -154,6 +154,13 @@
|
||||
<div class="md-margin" md-whiteframe="3">
|
||||
<div class="md-padding" layout="row" layout-wrap="layout-wrap">
|
||||
<div flex="50" flex-xs="100">
|
||||
<div class="sg-padded--bottom" ng-if="editor.certificate.emails.length">
|
||||
<div class="md-subhead md-default-theme md-fg md-primary"
|
||||
ng-bind="::'Email Addresses' | loc"><!-- Email Addresses --></div>
|
||||
<div class="pseudo-input-field md-body-1"
|
||||
ng-repeat="email in ::editor.certificate.emails"
|
||||
ng-bind="email"><!-- email address --></div>
|
||||
</div>
|
||||
<div class="md-subhead md-default-theme md-fg md-primary"
|
||||
ng-bind="::'Subject Name' | loc"><!-- Subject Name --></div>
|
||||
<div ng-repeat="field in editor.certificate.subject">
|
||||
|
||||
@@ -575,12 +575,17 @@
|
||||
* @desc Remove any S/MIME certificate associated with the account.
|
||||
* @returns a promise of the HTTP operation
|
||||
*/
|
||||
Card.prototype.$removeCertificate = function() {
|
||||
Card.prototype.$removeCertificate = function(immediate) {
|
||||
var _this = this;
|
||||
|
||||
return Card.$$resource.fetch(this.$path(), 'removeCertificate').then(function() {
|
||||
_this.hasCertificate = false;
|
||||
});
|
||||
if (immediate) {
|
||||
return Card.$$resource.fetch(this.$path(), 'removeCertificate').then(function() {
|
||||
_this.hasCertificate = false;
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.hasCertificate = false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -79,6 +79,11 @@
|
||||
focus('org_' + i);
|
||||
};
|
||||
|
||||
this.removeCertificate = function (form) {
|
||||
this.card.$removeCertificate();
|
||||
form.$setDirty();
|
||||
};
|
||||
|
||||
this.addBirthday = function () {
|
||||
this.card.birthday = new Date();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user