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(" ", "-")
|
||||
|
||||
# we don't want any overlapping certificate names
|
||||
if Certificate.query.filter(Certificate.name == final).all():
|
||||
final += '-1'
|
||||
count = Certificate.query.filter(func.lower(Certificate.name) == func.lower(final)).count()
|
||||
|
||||
if count:
|
||||
count += 1
|
||||
final += str(count)
|
||||
|
||||
return final
|
||||
|
||||
|
|
|
@ -132,7 +132,10 @@ def validate_schema(input_schema, output_schema):
|
|||
|
||||
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):
|
||||
return resp[0], resp[1]
|
||||
|
|
|
@ -102,6 +102,7 @@ angular.module('lemur')
|
|||
$scope.authorityConfig = {
|
||||
valueField: 'id',
|
||||
labelField: 'name',
|
||||
highlight: true,
|
||||
placeholder: 'Select Authority',
|
||||
maxItems: 1,
|
||||
onChange: function (value) {
|
||||
|
@ -141,19 +142,6 @@ angular.module('lemur')
|
|||
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) {
|
||||
WizardHandler.wizard().context.loading = true;
|
||||
CertificateService.create(certificate).then(
|
||||
|
|
Loading…
Reference in New Issue