diff --git a/internal/web/actions/default/servers/certs/uploadBatchPopup.go b/internal/web/actions/default/servers/certs/uploadBatchPopup.go index b0c4b1a0..9d4eb7ef 100644 --- a/internal/web/actions/default/servers/certs/uploadBatchPopup.go +++ b/internal/web/actions/default/servers/certs/uploadBatchPopup.go @@ -94,6 +94,12 @@ func (this *UploadBatchPopupAction) RunPost(params struct { return } + // 对比证书和私钥数量是否一致 + if len(certDataList) != len(keyDataList) { + this.Fail("证书文件数量(" + types.String(len(certDataList)) + ")和私钥文件数量(" + types.String(len(keyDataList)) + ")不一致") + return + } + // 自动匹配 var pairs = [][2][]byte{} // [] { cert, key } var keyIndexMap = map[int]bool{} // 方便下面跳过已匹配的Key diff --git a/web/views/@default/servers/certs/uploadBatchPopup.html b/web/views/@default/servers/certs/uploadBatchPopup.html index e89caa0f..807fce39 100644 --- a/web/views/@default/servers/certs/uploadBatchPopup.html +++ b/web/views/@default/servers/certs/uploadBatchPopup.html @@ -9,7 +9,7 @@ 选择要上传的证书和私钥文件 * -

点击后在弹出的文件选择框中支持多选。

+

点击后在弹出的文件选择框中支持多选;不用担心文件名和顺序问题,系统会自动匹配。

diff --git a/web/views/@default/servers/certs/uploadBatchPopup.js b/web/views/@default/servers/certs/uploadBatchPopup.js index cbe031f3..8330bce1 100644 --- a/web/views/@default/servers/certs/uploadBatchPopup.js +++ b/web/views/@default/servers/certs/uploadBatchPopup.js @@ -11,17 +11,13 @@ Tea.context(function () { } this.successUpload = function (resp) { - if (resp.data.count > 0) { - let msg = "html:成功上传" + resp.data.count + "个证书" - if (this.userId > 0) { - msg += "
由于你选择了证书用户,所以只有此用户才能在用户系统中查看到这些证书。" - } - teaweb.success(msg, function () { - NotifyPopup(resp) - }) - return + let msg = "html:成功上传" + resp.data.count + "个证书" + if (this.userId > 0) { + msg += "
由于你选择了证书用户,所以只有此用户才能在用户系统中查看到这些证书。" } - NotifyPopup(resp) + teaweb.success(msg, function () { + NotifyPopup(resp) + }) } this.changeUserId = function (userId) {