Merge branch 'develop' of http://192.168.10.125/k18_web/NFS.git into develop

This commit is contained in:
duandongmei
2018-10-17 17:22:19 +08:00
4 changed files with 108 additions and 3 deletions

View File

@@ -1247,3 +1247,8 @@ mail_address_reject=Mail Address Reject
ipsec_protocol=IPSEC Protocol
intercept_intensity=Intercept Related Domains
exceeds_duration_limit=File upload failure,The duration of uploaded files exceeds the limit.
file_in_wrong_format=File Format Error
select_certificate=Please Select Certificate Type First
root_certificate=der cer crt pem
intermediate_entity_certificate=p12
private_certificate=pem key p12

View File

@@ -1267,3 +1267,8 @@ mail_address_reject=Mail Address Reject
ipsec_protocol=IPSEC Protocol
intercept_intensity=Intercept Related Domains
exceeds_duration_limit=File upload failure,The duration of uploaded files exceeds the limit.
file_in_wrong_format=File Format Error
select_certificate=Please Select Certificate Type First
root_certificate=der cer crt pem
intermediate_entity_certificate=p12
private_certificate=pem key p12

View File

@@ -1241,3 +1241,8 @@ mail_address_reject=\u90AE\u4EF6\u5730\u5740\u7BA1\u63A7
ipsec_protocol=IPSEC\u534F\u8BAE
intercept_intensity=\u62E6\u622A\u5F3A\u5EA6
exceeds_duration_limit=\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25,\u6587\u4EF6\u65F6\u957F\u8D85\u51FA\u9650\u5236.
file_in_wrong_format=\u6587\u4EF6\u683C\u5F0F\u9519\u8BEF
select_certificate=\u8BF7\u5148\u9009\u62E9\u6587\u4EF6\u8BC1\u4E66\u7C7B\u578B
root_certificate=der cer crt pem
intermediate_entity_certificate=p12
private_certificate=pem key p12

View File

@@ -13,9 +13,11 @@ $(function(){
});
$("#publicKeyFileI").on('change', function() {
$("#publicKeyFileInfo").val($("#publicKeyFileI").val());
publicFileValidate();
});
$("#privateKeyFileI").on('change', function() {
$("#privateKeyFileInfo").val($("#privateKeyFileI").val());
privateFileValidate();
});
switchKeyringType();
$("select[name=keyringType]").on('change', function() {
@@ -37,6 +39,19 @@ $(function(){
var privateFile = $("#privateKeyFileI").val();
var publicKeyFile = $("#publicKeyFile").val();
var privateKeyFile = $("#privateKeyFile").val();
if(publicFile!=''){
if(!publicFileValidate()){
return false;
}
}
if(privateFile!=''){
if(!privateFileValidate()){
return false;
}
}
if((publicFile==null||publicFile=="") && (publicKeyFile==null || publicKeyFile=="")){
$("div[for='publicKeyFileI']").append("<label id='level-error' class='error' for='publicKeyFileI'><spring:message code='required'></spring:message></label>");
return false;
@@ -50,6 +65,7 @@ $(function(){
},
errorContainer: "#messageBox"
});
});
var switchCfgType=function(){
var cfgType=$("input[name='cfgType']:checked").val()
@@ -64,6 +80,20 @@ var switchCfgType=function(){
var switchKeyringType=function(){
var keyringType=$("select[name=keyringType]").val();
var expireAfter=$("input[name=expireAfter]").val();
if(keyringType!=''){
if(keyringType=='root'){
$("#publicInfo").empty();
$("#publicInfo").append("&nbsp;&nbsp;<label ><i class='fa fa-info-circle'></i>&nbsp;<spring:message code='root_certificate'/></label>");
}else{
$("#publicInfo").empty();
$("#publicInfo").append("&nbsp;&nbsp;<label ><i class='fa fa-info-circle'></i>&nbsp;<spring:message code='intermediate_entity_certificate'/></label>");
}
}else{
$("#publicInfo").empty();
// $("#publicInfo").append("&nbsp;&nbsp;<label style='color:#ea5200'><i class='fa fa-info-circle'></i>&nbsp;<spring:message code='select_certificate'/></label>");
}
if(keyringType =='end-entity'){ //实体证书不允许输入并且默认0
$("input[name=expireAfter]").val(0);
$(".expireAfter").addClass("hidden");
@@ -74,6 +104,64 @@ var switchKeyringType=function(){
$(".expireAfter").removeClass("hidden");
}
}
//增加对文件后缀名验证
function publicFileValidate(){
var keyringType=$("select[name=keyringType]").val();
var flag=false; //状态,检测文件后缀用
var arr=["der","cer","crt","pem","p12"];//使用是什么格式的后缀der、cer、crt、pem
if(keyringType=='root'){
arr=["der","cer","crt","pem"];
}else{
arr=["p12"];
}
var cFile=$("#publicKeyFileI").val();//文件的值
//取出上传文件的扩展名
var index=cFile.lastIndexOf(".");
var ext = cFile.substr(index+1).toLowerCase();
//循环比较
for(var i=0;i<arr.length;i++)
{
if(ext == arr[i])
{
flag = true; //一旦找到合适的,立即退出循环
break;
}
}
//条件判断
$("div[for='publicKeyFileInfo']").empty();
if(!flag){
// ("文件名不合法");
$("div[for='publicKeyFileInfo']").append("<label id='level-error' class='error'><spring:message code='file_in_wrong_format'/></label>");
return false;
}
return true;
}
function privateFileValidate(){
var flag=false; //状态,检测文件后缀用
var arr=["key","p12","pem"];//使用是什么格式的后缀pem、key、p12
var cFile=$("#privateKeyFileI").val();//文件的值
//取出上传文件的扩展名
var index=cFile.lastIndexOf(".");
var ext = cFile.substr(index+1).toLowerCase();
//循环比较
for(var i=0;i<arr.length;i++)
{
if(ext == arr[i])
{
flag = true; //一旦找到合适的,立即退出循环
break;
}
}
//条件判断
$("div[for='privateKeyFileInfo']").empty();
if(!flag){
// ("文件名不合法");
$("div[for='privateKeyFileInfo']").append("<label id='level-error' class='error'><spring:message code='file_in_wrong_format'/></label>");
return false;
}
return true;
}
</script>
</head>
<body>
@@ -189,6 +277,7 @@ var switchKeyringType=function(){
<input id="publicKeyFile" name="publicKeyFile" type="hidden" value="${_cfg.publicKeyFile }"/>
</div>
</div>
<div id="publicInfo"></div>
<div for="publicKeyFileInfo"></div>
</div>
</div>
@@ -214,6 +303,7 @@ var switchKeyringType=function(){
<input id="privateKeyFile" name="privateKeyFile" type="hidden" value="${_cfg.privateKeyFile }"/>
</div>
</div>
&nbsp;&nbsp;<label ><i class='fa fa-info-circle'></i>&nbsp;<spring:message code='private_certificate'/></label>
<div for="privateKeyFileInfo"></div>
</div>
</div>