diff --git a/gui/templates/views/manage.tmpl b/gui/templates/views/manage.tmpl index 6f8d235..eea105d 100644 --- a/gui/templates/views/manage.tmpl +++ b/gui/templates/views/manage.tmpl @@ -380,9 +380,7 @@ - {{ with .CertificateInfo.Errors.Modal }} - {{ . }}
- {{ end }} +
@@ -395,9 +393,7 @@

CRL

Please provide the CRL for the Root CA.

- {{ with .CertificateInfo.Errors.Modal }} - {{ . }}
- {{ end }} +
@@ -864,7 +860,6 @@ $("#issuer-crl-result").removeClass("hidden").removeClass("error").show().html(msg).addClass("success"); } else { - console.log("***DEBUG*** 1 ", data); $("#issuer-crl-result").removeClass("hidden").removeClass("success").show().text(data.Errors["CRL"]).addClass("error"); } }) @@ -893,7 +888,6 @@ return false; } else { - console.log("***DEBUG*** 2 ", data); $("#root-crl-result").removeClass("hidden").removeClass("success").show().text(data.Errors["CRL"]).addClass("error"); } }) @@ -903,36 +897,42 @@ }); } else if ( $(evt.target).attr("id") == "modal-root-key-upload") { - $('#modal-root-key').modal('hide'); - $.ajax(window.location.href, { - method: "POST", - data: { - action: 'gen-root-crl', - rootkey: $("#modal-rootkey").val(), - rootpassphrase: $("#modal-rootpassphrase").val(), - }, - }) - .done(function(data) { + if ($("#modal-rootkey").val() == "") { $('#modal-spinner').modal('hide'); - $('.modal-backdrop').remove(); + $("#modal-root-key-error").show().text("Please provide the root key"); + return false; + } else { + $('#modal-root-key').modal('hide'); + $("#modal-root-key-error").hide(); + $.ajax(window.location.href, { + method: "POST", + data: { + action: 'gen-root-crl', + rootkey: $("#modal-rootkey").val(), + rootpassphrase: $("#modal-rootpassphrase").val(), + }, + }) + .done(function(data) { + $('#modal-spinner').modal('hide'); + $('.modal-backdrop').remove(); - if (data.Success) { - var msg = "Successfully generated Root CRL.
"; - $("#root-crl-result").removeClass("hidden").removeClass("error").show().html(msg).addClass("success"); + if (data.Success) { + var msg = "Successfully generated Root CRL.
"; + $("#root-crl-result").removeClass("hidden").removeClass("error").show().html(msg).addClass("success"); - } else if (data.Errors["CRL"] == "NO_ROOT_KEY") { - $('#modal-root-key').modal('show'); - return false; + } else if (data.Errors["CRL"] == "NO_ROOT_KEY") { + $('#modal-root-key').modal('show'); + return false; - } else { - console.log("***DEBUG*** 3 ", data); - $("#root-crl-result").removeClass("hidden").removeClass("success").show().text(data.Errors["CRL"]).addClass("error"); - } - }) - .fail(function(xhr, status, err) { - $('#modal-spinner').modal('hide'); - $("#root-crl-result").removeClass("hidden").removeClass("success").show().html(err + "
").addClass("error"); - }); + } else { + $("#root-crl-result").removeClass("hidden").removeClass("success").show().text(data.Errors["CRL"]).addClass("error"); + } + }) + .fail(function(xhr, status, err) { + $('#modal-spinner').modal('hide'); + $("#root-crl-result").removeClass("hidden").removeClass("success").show().html(err + "
").addClass("error"); + }); + } } else if ( $(evt.target).attr("id") == "upload-root-crl") { $('#modal-spinner').modal('hide'); @@ -940,30 +940,36 @@ return false; } else if ( $(evt.target).attr("id") == "modal-crl-done") { - $('#modal-crl').modal('hide'); - $.ajax(window.location.href, { - method: "POST", - data: { - action: 'upload-root-crl', - crl: $("#modal-crl-val").val(), - }, - }) - .done(function(data) { + if ($("#modal-crl-val").val() == "") { $('#modal-spinner').modal('hide'); + $("#modal-crl-error").show().text("Please provide CRL content"); + return false; + } else { + $('#modal-crl').modal('hide'); + $("#modal-crl-error").hide(); + $.ajax(window.location.href, { + method: "POST", + data: { + action: 'upload-root-crl', + crl: $("#modal-crl-val").val(), + }, + }) + .done(function(data) { + $('#modal-spinner').modal('hide'); - if (data.Success) { - var msg = "Successfully uploaded Root CRL.
"; - $("#root-crl-result").removeClass("hidden").removeClass("error").show().html(msg).addClass("success"); + if (data.Success) { + var msg = "Successfully uploaded Root CRL.
"; + $("#root-crl-result").removeClass("hidden").removeClass("error").show().html(msg).addClass("success"); - } else { - console.log("***DEBUG*** 4 ", data); - $("#root-crl-result").removeClass("hidden").removeClass("success").show().text(data.Errors["CRL"]).addClass("error"); - } - }) - .fail(function(xhr, status, err) { - $('#modal-spinner').modal('hide'); - $("#root-crl-result").removeClass("hidden").removeClass("success").show().html(err + "
").addClass("error"); - }); + } else { + $("#root-crl-result").removeClass("hidden").removeClass("success").show().text(data.Errors["CRL"]).addClass("error"); + } + }) + .fail(function(xhr, status, err) { + $('#modal-spinner').modal('hide'); + $("#root-crl-result").removeClass("hidden").removeClass("success").show().html(err + "
").addClass("error"); + }); + } } else if ( $(evt.target).attr("id") == "cancel-rootkey" || $(evt.target).attr("id") == "cancel-crl") { $('#modal-spinner').modal('hide');