From 77f13c9edbd8808dfeecd0846a5d6eb5fea2a4b6 Mon Sep 17 00:00:00 2001 From: kevgliss Date: Mon, 6 Jun 2016 12:11:40 -0700 Subject: [PATCH] =?UTF-8?q?Fixing=20issue=20were,=20after=20a=20user=20cha?= =?UTF-8?q?nges=20their=20mind=20validity=20years=20wil=E2=80=A6=20(#349)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lemur/authorities/schemas.py | 4 ++-- lemur/static/app/angular/authorities/services.js | 3 +++ lemur/static/app/angular/certificates/services.js | 9 ++------- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lemur/authorities/schemas.py b/lemur/authorities/schemas.py index 10187c23..cc045504 100644 --- a/lemur/authorities/schemas.py +++ b/lemur/authorities/schemas.py @@ -23,8 +23,8 @@ class AuthorityInputSchema(LemurInputSchema): description = fields.String() common_name = fields.String(required=True, validate=validators.sensitive_domain) - validity_start = fields.Date() - validity_end = fields.Date() + validity_start = fields.DateTime() + validity_end = fields.DateTime() validity_years = fields.Integer() # certificate body fields diff --git a/lemur/static/app/angular/authorities/services.js b/lemur/static/app/angular/authorities/services.js index e7da9c85..4af4daab 100644 --- a/lemur/static/app/angular/authorities/services.js +++ b/lemur/static/app/angular/authorities/services.js @@ -85,6 +85,9 @@ angular.module('lemur') AuthorityService.create = function (authority) { authority.attachSubAltName(); authority.attachCustom(); + if (authority.validityYears === '') { // if a user de-selects validity years we ignore it + delete authority.validityYears; + } return AuthorityApi.post(authority); }; diff --git a/lemur/static/app/angular/certificates/services.js b/lemur/static/app/angular/certificates/services.js index 4f69a889..c745db3d 100644 --- a/lemur/static/app/angular/certificates/services.js +++ b/lemur/static/app/angular/certificates/services.js @@ -125,13 +125,8 @@ angular.module('lemur') CertificateService.create = function (certificate) { certificate.attachSubAltName(); certificate.attachCustom(); - // Help users who may have just typed in their authority - if (!certificate.authority) { - AuthorityService.findActiveAuthorityByName(certificate.selectedAuthority).then(function (authorities) { - if (authorities.length > 0) { - certificate.authority = authorities[0]; - } - }); + if (certificate.validityYears === '') { // if a user de-selects validity years we ignore it + delete certificate.validityYears; } return CertificateApi.post(certificate); };