diff --git a/ajax/networking/do_sys_reset.php b/ajax/networking/do_sys_reset.php
index b5c65481..05f36615 100644
--- a/ajax/networking/do_sys_reset.php
+++ b/ajax/networking/do_sys_reset.php
@@ -25,8 +25,9 @@ if (isset($_POST['csrf_token'])) {
} catch (Exception $e) {
$return = $e->getCode();
}
- }
- echo json_encode($return);
+ }
+ $jsonData = ['return'=>$return];
+ echo json_encode($jsonData);
} else {
handleInvalidCSRFToken();
diff --git a/app/js/custom.js b/app/js/custom.js
index d109f080..6c239840 100644
--- a/app/js/custom.js
+++ b/app/js/custom.js
@@ -20,7 +20,6 @@ function createNetmaskAddr(bitCount) {
function loadSummary(strInterface) {
$.post('ajax/networking/get_ip_summary.php',{interface:strInterface},function(data){
jsonData = JSON.parse(data);
- console.log(jsonData);
if(jsonData['return'] == 0) {
$('#'+strInterface+'-summary').html(jsonData['output'].join('
'));
} else if(jsonData['return'] == 2) {
@@ -323,18 +322,23 @@ $('#ovpn-userpw,#ovpn-certs').on('click', function (e) {
});
$('#js-system-reset-confirm').on('click', function (e) {
- var resetHtml = $('#js-system-reset-confirm').attr('data-message');
- var successHtml = $('#js-system-reset-message').attr('data-message');
+ var progressHtml = $('#js-system-reset-confirm').attr('data-message');
+ var successHtml = $('#system-reset-message').attr('data-message');
+ var closeHtml = $('#js-system-reset-cancel').attr('data-message');
var csrfToken = $('meta[name=csrf_token]').attr('content');
- resetHtml += '';
- $('#system-reset-message').html(resetHtml);
+ progressHtml += '';
+ $('#system-reset-message').html(progressHtml);
$.post('ajax/networking/do_sys_reset.php?',{'csrf_token':csrfToken},function(data){
setTimeout(function(){
- $('#system-reset-message').text('Reset complete. Restart the hotspot for the changes to take effect.');
- var response = JSON.parse(data);
- console.log(response);
- //$('#system-reset-message').text(responseText);
- },1000);
+ jsonData = JSON.parse(data);
+ if(jsonData['return'] == 0) {
+ $('#system-reset-message').text(successHtml);
+ } else {
+ $('#system-reset-message').text('Error occured: '+ jsonData['return']);
+ }
+ $("#js-system-reset-confirm").hide();
+ $("#js-system-reset-cancel").text(closeHtml);
+ },750);
});
});
@@ -480,7 +484,6 @@ window.addEventListener('load', function() {
// Loop over them and prevent submission
var validation = Array.prototype.filter.call(forms, function(form) {
form.addEventListener('submit', function(event) {
- //console.log(event.submitter);
if (form.checkValidity() === false) {
event.preventDefault();
event.stopPropagation();
diff --git a/templates/system.php b/templates/system.php
index 3bc29058..65a3834e 100755
--- a/templates/system.php
+++ b/templates/system.php
@@ -42,10 +42,10 @@