Fix issue with cert file read

revert-dabc3590
Pahansith Gunathilake 6 years ago committed by Charitha Goonetilleke
parent df5e833f77
commit c3d7525178

@ -174,14 +174,14 @@ var ovpnConfigUploaded = function () {
};
var certConfigUploaded = function (val) {
var certFileInput = document.getElementById("cert-file-field");
if ('files' in certFileInput) {
if (certFileInput.files.length === 1) {
var certFileInput = $(val);
if (certFileInput[0].files) {
if (certFileInput[0].files.length === 1) {
var reader = new FileReader();
reader.onload = function (progressEvent) {
reader.onload = function(progressEvent){
var txt = "";
var lines = this.result.split('\n');
for (var line = 0; line < lines.length; line++) {
for(var line = 0; line < lines.length; line++){
console.log(lines[line]);
if (lines[line].charAt(0) !== '#') {
txt += lines[line] + '\n';
@ -191,7 +191,7 @@ var certConfigUploaded = function (val) {
//console.log(document.getElementById ("cert-config").value);
$(val).next().val(txt);
};
reader.readAsText(certFileInput.files[0]);
reader.readAsText(certFileInput[0].files[0]);
}
}
};

@ -78,9 +78,9 @@
</a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('cert', this)">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-security-policy fw-stack-2x"></i>
<i class="fw fw-pages fw-stack-2x"></i>
</span>
Secure Certificates
Certificates Install
<span id="cert-configured" class="has-configured status-icon hidden"><i class="fw fw-success"></i></span>
<span id="cert-ok" class="has-success status-icon hidden"><i class="fw fw-success"></i></span>
<span id="cert-error" class="has-error status-icon hidden"><i class="fw fw-error"></i></span>
@ -1431,7 +1431,7 @@
data-operation-code="INSTALL_CERT">
<div id="cert-heading" class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
Secure Certificate Settings
Certificate Install Settings
<label class="wr-input-control switch" data-toggle="collapse"
data-target="#cert-body">
<input type="checkbox"/>
@ -1440,7 +1440,7 @@
</label>
</h2>
<div class="panel-title-description">
Configure the Secure Certificate settings on Android devices.
Configure the certificate install settings on Android devices.
</div>
</div>
<div id="cert-body" class="panel-collapse panel-body collapse" role="tabpanel"

@ -61,9 +61,9 @@
</a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('cert', this)">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-security-policy fw-stack-2x"></i>
<i class="fw fw-pages fw-stack-2x"></i>
</span>
Secure Certificate
Certificate Install
<span id="cert-configured" class="has-configured status-icon hidden"><i class="fw fw-success"></i></span>
<span id="cert-ok" class="has-success status-icon hidden"><i class="fw fw-success"></i></span>
<span id="cert-error" class="has-error status-icon hidden"><i class="fw fw-error"></i></span>
@ -2327,7 +2327,7 @@
data-operation-code="INSTALL_CERT">
<div id="cert-heading" class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
Secure Certificate Settings
Certificate Install Settings
<label class="wr-input-control switch hidden" data-toggle="collapse"
data-target="#cert-body">
<input type="checkbox"/>
@ -2336,7 +2336,7 @@
</label>
</h2>
<div class="panel-title-description">
Configure the Secure Certificate settings on Android devices.
Configure the certificate install settings on Android devices.
</div>
</div>
<div id="cert-body" class="panel-collapse panel-body collapse" role="tabpanel"

@ -115,11 +115,10 @@ var ovpnConfigUploaded = function () {
}
};
var certConfigUploaded = function (val) {
var certFileInput = document.getElementById("cert-file-field");
if ('files' in certFileInput) {
if (certFileInput.files.length === 1) {
var certFileInput = $(val);
if (certFileInput[0].files) {
if (certFileInput[0].files.length === 1) {
var reader = new FileReader();
reader.onload = function(progressEvent){
var txt = "";
@ -134,7 +133,7 @@ var certConfigUploaded = function (val) {
//console.log(document.getElementById ("cert-config").value);
$(val).next().val(txt);
};
reader.readAsText(certFileInput.files[0]);
reader.readAsText(certFileInput[0].files[0]);
}
}
};

@ -78,9 +78,9 @@
</a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('cert', this)">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-security-policy fw-stack-2x"></i>
<i class="fw fw-pages fw-stack-2x"></i>
</span>
Secure Certificate
Certificate Install
<span id="cert-configured" class="has-configured status-icon hidden"><i class="fw fw-success"></i></span>
<span id="cert-ok" class="has-success status-icon hidden"><i class="fw fw-success"></i></span>
<span id="cert-error" class="has-error status-icon hidden"><i class="fw fw-error"></i></span>
@ -2346,7 +2346,7 @@
data-operation-code="INSTALL_CERT">
<div id="cert-heading" class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
Secure Certificate Settings
Certificate Install Settings
<label class="wr-input-control switch" data-toggle="collapse"
data-target="#cert-body">
<input type="checkbox"/>
@ -2355,7 +2355,7 @@
</label>
</h2>
<div class="panel-title-description">
Configure the Secure Certificate settings on Android devices.
Configure the certificate install settings on Android devices.
</div>
</div>
<div id="cert-body" class="panel-collapse panel-body collapse" role="tabpanel"

Loading…
Cancel
Save