diff --git a/UI/Contacts/UIxContactActions.m b/UI/Contacts/UIxContactActions.m index 1defa6c3c..01460668c 100644 --- a/UI/Contacts/UIxContactActions.m +++ b/UI/Contacts/UIxContactActions.m @@ -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]; } diff --git a/UI/Contacts/UIxContactEditor.m b/UI/Contacts/UIxContactEditor.m index e7741fc1d..e01475d87 100644 --- a/UI/Contacts/UIxContactEditor.m +++ b/UI/Contacts/UIxContactEditor.m @@ -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]; } diff --git a/UI/Templates/ContactsUI/UIxContactEditorTemplate.wox b/UI/Templates/ContactsUI/UIxContactEditorTemplate.wox index d96e9037b..9f59610c4 100644 --- a/UI/Templates/ContactsUI/UIxContactEditorTemplate.wox +++ b/UI/Templates/ContactsUI/UIxContactEditorTemplate.wox @@ -145,7 +145,7 @@ {{::'S/MIME Certificate' | loc}}

+ ng-click="editor.removeCertificate(contactForm)"> expand_more @@ -154,6 +154,13 @@
+
+
+
+
diff --git a/UI/WebServerResources/js/Contacts/Card.service.js b/UI/WebServerResources/js/Contacts/Card.service.js index e0a73189c..af2c8050e 100644 --- a/UI/WebServerResources/js/Contacts/Card.service.js +++ b/UI/WebServerResources/js/Contacts/Card.service.js @@ -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; + } }; /** diff --git a/UI/WebServerResources/js/Contacts/CardController.js b/UI/WebServerResources/js/Contacts/CardController.js index f4241251c..9d2c1a307 100644 --- a/UI/WebServerResources/js/Contacts/CardController.js +++ b/UI/WebServerResources/js/Contacts/CardController.js @@ -79,6 +79,11 @@ focus('org_' + i); }; + this.removeCertificate = function (form) { + this.card.$removeCertificate(); + form.$setDirty(); + }; + this.addBirthday = function () { this.card.birthday = new Date(); };