Browse Source

remove a certificate upload and the auth toggle

Avetisyan Karen 3 years ago
parent
commit
9864772b62

BIN
web_interface/dist/wui-11/main.js


BIN
web_interface/dist/wui-11/settings.html


+ 1 - 47
web_interface/src/wui-11/main.js

@@ -248,17 +248,6 @@ function ValidateAlphanumericPlus(uadd, z) {
   return false;
   return false;
 }
 }
 
 
-function validateUpload(oForm) {
-  var file = oForm.elements.datafile.files[0];
-  var fnmreg = /^.{1,}\.crt$/g;
-
-  if (file && fnmreg.test(file.name) ) {
-    upload(file);
-  } else {
-    alert('Файл сертификата не указан или не валиден!');
-  }
-  return false;
-}
 
 
 function submitForms() {
 function submitForms() {
   if (confirm('Вы уверены что хотите применить настройки?')) {
   if (confirm('Вы уверены что хотите применить настройки?')) {
@@ -273,30 +262,7 @@ function submitForms() {
     }
     }
   }
   }
 }
 }
-function upload(file) {
-  var fl = new FormData();
-  fl.append('file', file);
-  var xhr = new XMLHttpRequest();
-  xhr.open('POST', '/srv_crt_upload.cgi', true);
-  // обработчик для закачки
-  xhr.upload.onprogress = function(event) {
-    var progress = Math.floor((event.loaded / event.total) * 100);
-    console.log(progress + '%');
-  };
-  xhr.onload = xhr.onerror = function() {
-    if (this.status == 200) {
-      if (+xhr.responseText == '1') {
-        alert('Успешно');
-        window.location.reload();
-      } else {
-        alert('Ошибка установки сертификата');
-      }
-    } else {
-      alert('Ошибка ' + this.status);
-    }
-  };
-  xhr.send(fl);
-}
+
 function checkPWD(){
 function checkPWD(){
   // $('checkUpdatePass').style.display = 'none';
   // $('checkUpdatePass').style.display = 'none';
   $('count-wrap').style.display = 'block';
   $('count-wrap').style.display = 'block';
@@ -436,17 +402,6 @@ function radiusState() {
   }
   }
 }
 }
 
 
-function authState() {
-  if (!$('swauth').checked) {
-    $('rs_enabled').setAttribute('disabled', 'disabled');
-    $('rs_enabled').checked = false;
-  } else {
-    $('rs_enabled').removeAttribute('disabled');
-    // $('rs_enabled').checked = true;
-  }
-  radiusState();
-}
-
 //########## Info Form Validation ############
 //########## Info Form Validation ############
 
 
 function infoValidation(){
 function infoValidation(){
@@ -985,7 +940,6 @@ function settingsGET(){
     $('rs_pwd').value       = data.rs_pwd;
     $('rs_pwd').value       = data.rs_pwd;
     $('rs_key').value       = data.rs_key;
     $('rs_key').value       = data.rs_key;
     $('rs_enabled').checked = data.rs_enabled;
     $('rs_enabled').checked = data.rs_enabled;
-    $('swauth').checked     = data.swauth;
     // Whitelist
     // Whitelist
     $('wtl_ip1').value = data.wtl_ip1;
     $('wtl_ip1').value = data.wtl_ip1;
     $('wtl_ip2').value = data.wtl_ip2;
     $('wtl_ip2').value = data.wtl_ip2;

+ 0 - 41
web_interface/src/wui-11/settings.html

@@ -28,20 +28,6 @@
       <input type="submit" class="btn btn-success-inverted" onclick="checkChangePWD(); return false;" value="Отправить">
       <input type="submit" class="btn btn-success-inverted" onclick="checkChangePWD(); return false;" value="Отправить">
     </form>
     </form>
   </div>
   </div>
-  <div id='uploadCertificate'>
-    <form name="upload" onsubmit="return validateUpload(this);">
-      <p>Загрузка сертификата.</p>
-      <div class="upload-wrapper">
-        <input id="uploadFile" placeholder="Файл" disabled="disabled" class="file-name" />
-        <div class="fileUpload btn btn-primary">
-          <span>Выбор файла</span>
-          <input id="uploadBtn" type="file" class="upload" name="datafile"/>
-        </div>
-      </div>
-      <input type="button" id="close-cert" class="btn btn-danger-inverted" value="Отмена">
-      <input class="btn btn-success-inverted" type="submit" value="Загрузить">
-    </form>
-  </div>
   <div id='ftpFWDownload'>
   <div id='ftpFWDownload'>
       <div class="section group">
       <div class="section group">
         <label for="dev_update_method" class="col span_1_of_2">Способ обновления</label>
         <label for="dev_update_method" class="col span_1_of_2">Способ обновления</label>
@@ -442,23 +428,6 @@
         <input type="text" class="form-control" id="rs_key" name="rs_key">
         <input type="text" class="form-control" id="rs_key" name="rs_key">
       </div>
       </div>
     </div>
     </div>
-    <div class="col span_1_of_2">
-      <h4 class="col span_2_of_2">Контроллер</h4>
-      <div class="checkbox col span_2_of_2">
-        <label>
-          <input type="checkbox" name="swauth" id="swauth" onchange="authState()"> Включить авторизацию
-        </label>
-      </div>
-      <div class="col span_2_of_2">
-        <button type="button" class="btn btn-default" id="get-cert" onclick="return blobLoad('getcert.cgi', 'certificate.req', this.id);">
-          <span id="bl_text">Запрос на сертификат</span>
-          <div id="bl_fill"></div>
-        </button>
-      </div>
-      <div class="col span_2_of_2">
-        <button type="button" class="btn btn-default" id="set-cert">Загрузить сертификат...</button>
-      </div>
-    </div>
   </div>
   </div>
 </div>
 </div>
 <div id="ntpt" class="tabpane">
 <div id="ntpt" class="tabpane">
@@ -580,16 +549,6 @@ $('dev-update').onclick = function(){
   $('count-wrap').style.display = 'block';
   $('count-wrap').style.display = 'block';
   $('ftpFWDownload').style.display = 'block';
   $('ftpFWDownload').style.display = 'block';
 };
 };
-$('set-cert').onclick = function(){
-  $('count-wrap').style.display = 'block';
-  $('uploadCertificate').style.display = 'block';
-};
-$('close-cert').onclick = function() {
-  $('count-wrap').style.display = 'none';
-  $('uploadCertificate').style.display = 'none';
-  $('uploadBtn').innerHTML = $('uploadBtn').innerHTML;
-  $('uploadFile').value = '';
-};
 $('close_fw_update').onclick = function(){
 $('close_fw_update').onclick = function(){
   $('count-wrap').style.display = 'none';
   $('count-wrap').style.display = 'none';
   $('ftpFWDownload').style.display = 'none';
   $('ftpFWDownload').style.display = 'none';