批量上传时如果证书文件和私钥文件不一致,也会提示错误

This commit is contained in:
GoEdgeLab
2023-03-24 15:13:28 +08:00
parent 8d1eb31b30
commit f5d95a01f5
3 changed files with 13 additions and 11 deletions

View File

@@ -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

View File

@@ -9,7 +9,7 @@
<td class="title">选择要上传的证书和私钥文件 *</td>
<td>
<input type="file" name="certFiles" accept="application/x-pem-file, application/pkcs10, application/x-pkcs12, application/x-x509-user-cert, application/x-x509-ca-cert, application/pkix-cert, application/pkcs8, .key, .pem" multiple="multiple"/>
<p class="comment">点击后在弹出的文件选择框中支持多选。</p>
<p class="comment">点击后在弹出的文件选择框中支持多选;不用担心文件名和顺序问题,系统会自动匹配</p>
</td>
</tr>
<tr>

View File

@@ -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 += "<br/>由于你选择了证书用户,所以只有此用户才能在用户系统中查看到这些证书。"
}
teaweb.success(msg, function () {
NotifyPopup(resp)
})
return
let msg = "html:成功上传" + resp.data.count + "个证书"
if (this.userId > 0) {
msg += "<br/>由于你选择了证书用户,所以只有此用户才能在用户系统中查看到这些证书。"
}
NotifyPopup(resp)
teaweb.success(msg, function () {
NotifyPopup(resp)
})
}
this.changeUserId = function (userId) {