Adding a better comparison. (#320)
This commit is contained in:
parent
1763a1a717
commit
b187d8f836
|
@ -65,8 +65,11 @@ def create_name(issuer, not_before, not_after, subject, san):
|
||||||
final = temp.replace(" ", "-")
|
final = temp.replace(" ", "-")
|
||||||
|
|
||||||
# we don't want any overlapping certificate names
|
# we don't want any overlapping certificate names
|
||||||
if Certificate.query.filter(Certificate.name == final).all():
|
count = Certificate.query.filter(func.lower(Certificate.name) == func.lower(final)).count()
|
||||||
final += '-1'
|
|
||||||
|
if count:
|
||||||
|
count += 1
|
||||||
|
final += str(count)
|
||||||
|
|
||||||
return final
|
return final
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,10 @@ def validate_schema(input_schema, output_schema):
|
||||||
|
|
||||||
kwargs['data'] = data
|
kwargs['data'] = data
|
||||||
|
|
||||||
resp = f(*args, **kwargs)
|
try:
|
||||||
|
resp = f(*args, **kwargs)
|
||||||
|
except Exception as e:
|
||||||
|
return dict(message=e.message), 500
|
||||||
|
|
||||||
if isinstance(resp, tuple):
|
if isinstance(resp, tuple):
|
||||||
return resp[0], resp[1]
|
return resp[0], resp[1]
|
||||||
|
|
|
@ -102,6 +102,7 @@ angular.module('lemur')
|
||||||
$scope.authorityConfig = {
|
$scope.authorityConfig = {
|
||||||
valueField: 'id',
|
valueField: 'id',
|
||||||
labelField: 'name',
|
labelField: 'name',
|
||||||
|
highlight: true,
|
||||||
placeholder: 'Select Authority',
|
placeholder: 'Select Authority',
|
||||||
maxItems: 1,
|
maxItems: 1,
|
||||||
onChange: function (value) {
|
onChange: function (value) {
|
||||||
|
@ -141,19 +142,6 @@ angular.module('lemur')
|
||||||
opened: false
|
opened: false
|
||||||
};
|
};
|
||||||
|
|
||||||
var formatAuthorities = function (authorities) {
|
|
||||||
var newAuthorities = [];
|
|
||||||
angular.forEach(authorities, function (authority) {
|
|
||||||
authority.formatted = authority.name + '<span class="text-muted"> - ' + authority.description + '</span>';
|
|
||||||
newAuthorities.push(authority);
|
|
||||||
});
|
|
||||||
return newAuthorities;
|
|
||||||
};
|
|
||||||
|
|
||||||
AuthorityService.findActiveAuthorityByName().then(function (authorities) {
|
|
||||||
$scope.authorities = formatAuthorities(authorities);
|
|
||||||
});
|
|
||||||
|
|
||||||
$scope.create = function (certificate) {
|
$scope.create = function (certificate) {
|
||||||
WizardHandler.wizard().context.loading = true;
|
WizardHandler.wizard().context.loading = true;
|
||||||
CertificateService.create(certificate).then(
|
CertificateService.create(certificate).then(
|
||||||
|
|
Loading…
Reference in New Issue