mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-09 08:15:13 +03:00
WebUI: make error messages user dismissible
Fixes #1171 Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -28,8 +28,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{{if .Error}}
|
||||
<div class="card mb-4 border-left-warning">
|
||||
<div class="card-body text-form-error">{{.Error}}</div>
|
||||
<div class="alert alert-warning alert-dismissible fade show" role="alert">
|
||||
{{.Error}}
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
{{end}}
|
||||
<form id="admin_form" action="{{.CurrentURL}}" method="POST" autocomplete="off">
|
||||
|
||||
@@ -28,12 +28,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
{{define "page_body"}}
|
||||
|
||||
<div id="errorMsg" class="card mb-4 border-left-warning" style="display: none;">
|
||||
<div id="errorTxt" class="card-body text-form-error"></div>
|
||||
</div>
|
||||
|
||||
<div id="successMsg" class="card mb-4 border-left-success" style="display: none;">
|
||||
<div id="successTxt" class="card-body"></div>
|
||||
<div id="errorMsg" class="alert alert-warning alert-dismissible fade show" style="display: none;" role="alert">
|
||||
<span id="errorTxt"></span>
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="card shadow mb-4">
|
||||
@@ -130,6 +129,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
var username = table.row({ selected: true }).data()[1];
|
||||
var path = '{{.AdminURL}}' + "/" + fixedEncodeURIComponent(username);
|
||||
$('#deleteModal').modal('hide');
|
||||
$('#errorMsg').hide();
|
||||
$.ajax({
|
||||
url: path,
|
||||
type: 'DELETE',
|
||||
@@ -153,9 +153,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
}
|
||||
$('#errorTxt').text(txt);
|
||||
$('#errorMsg').show();
|
||||
setTimeout(function () {
|
||||
$('#errorMsg').hide();
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -55,8 +55,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
<h1 class="h5 text-gray-900 mb-4">To start using SFTPGo you need to create an admin user</h1>
|
||||
</div>
|
||||
{{if .Error}}
|
||||
<div class="card mb-4 border-left-warning">
|
||||
<div class="card-body text-form-error">{{.Error}}</div>
|
||||
<div class="alert alert-warning alert-dismissible fade show" role="alert">
|
||||
{{.Error}}
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
{{end}}
|
||||
<form id="login_form" action="{{.CurrentURL}}" method="POST" autocomplete="off"
|
||||
|
||||
@@ -25,8 +25,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{{if .Error}}
|
||||
<div class="card mb-4 border-left-warning">
|
||||
<div class="card-body text-form-error">{{.Error}}</div>
|
||||
<div class="alert alert-warning alert-dismissible fade show" role="alert">
|
||||
{{.Error}}
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
{{end}}
|
||||
<form id="user_form" action="{{.CurrentURL}}" method="POST" autocomplete="off">
|
||||
|
||||
@@ -26,8 +26,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
{{end}}
|
||||
|
||||
{{define "page_body"}}
|
||||
<div id="errorMsg" class="card mb-4 border-left-warning" style="display: none;">
|
||||
<div id="errorTxt" class="card-body text-form-error"></div>
|
||||
<div id="errorMsg" class="alert alert-warning alert-dismissible fade show" style="display: none;" role="alert">
|
||||
<span id="errorTxt"></span>
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="card shadow mb-4">
|
||||
@@ -105,13 +108,15 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
<script type="text/javascript">
|
||||
|
||||
function disconnectAction() {
|
||||
var table = $('#dataTable').DataTable();
|
||||
let table = $('#dataTable').DataTable();
|
||||
table.button('disconnect:name').enable(false);
|
||||
var selectedData = table.row({ selected: true }).data()
|
||||
var connectionID = selectedData[0];
|
||||
var nodeID = selectedData[1];
|
||||
var path = '{{.ConnectionsURL}}' + "/" + fixedEncodeURIComponent(connectionID)+"?node="+encodeURIComponent(nodeID);
|
||||
let selectedData = table.row({ selected: true }).data()
|
||||
let connectionID = selectedData[0];
|
||||
let nodeID = selectedData[1];
|
||||
let path = '{{.ConnectionsURL}}' + "/" + fixedEncodeURIComponent(connectionID)+"?node="+encodeURIComponent(nodeID);
|
||||
$('#disconnectModal').modal('hide');
|
||||
$('#errorMsg').hide();
|
||||
|
||||
$.ajax({
|
||||
url: path,
|
||||
type: 'DELETE',
|
||||
@@ -119,9 +124,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
headers: {'X-CSRF-TOKEN' : '{{.CSRFToken}}'},
|
||||
timeout: 15000,
|
||||
success: function (result) {
|
||||
setTimeout(function () {
|
||||
window.location.href = '{{.ConnectionsURL}}';
|
||||
}, 1000);
|
||||
window.location.href = '{{.ConnectionsURL}}';
|
||||
},
|
||||
error: function ($xhr, textStatus, errorThrown) {
|
||||
var txt = "Failed to close the selected connection";
|
||||
@@ -137,9 +140,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
}
|
||||
$('#errorTxt').text(txt);
|
||||
$('#errorMsg').show();
|
||||
setTimeout(function () {
|
||||
$('#errorMsg').hide();
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -26,8 +26,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
{{end}}
|
||||
|
||||
{{define "page_body"}}
|
||||
<div id="errorMsg" class="card mb-4 border-left-warning" style="display: none;">
|
||||
<div id="errorTxt" class="card-body text-form-error"></div>
|
||||
<div id="errorMsg" class="alert alert-warning alert-dismissible fade show" style="display: none;" role="alert">
|
||||
<span id="errorTxt"></span>
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="card shadow mb-4">
|
||||
<div class="card-header py-3">
|
||||
@@ -94,6 +97,8 @@ function deleteAction() {
|
||||
let id = table.row({ selected: true }).data()["id"];
|
||||
let path = '{{.DefenderHostsURL}}' + "/" + fixedEncodeURIComponent(id);
|
||||
$('#deleteModal').modal('hide');
|
||||
$('#errorMsg').hide();
|
||||
|
||||
$.ajax({
|
||||
url: path,
|
||||
type: 'DELETE',
|
||||
@@ -117,9 +122,6 @@ function deleteAction() {
|
||||
}
|
||||
$('#errorTxt').text(txt);
|
||||
$('#errorMsg').show();
|
||||
setTimeout(function () {
|
||||
$('#errorMsg').hide();
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -163,9 +165,6 @@ function deleteAction() {
|
||||
}
|
||||
$('#errorTxt').text(txt);
|
||||
$('#errorMsg').show();
|
||||
setTimeout(function () {
|
||||
$('#errorMsg').hide();
|
||||
}, 10000);
|
||||
}
|
||||
},
|
||||
"deferRender": true,
|
||||
|
||||
@@ -39,8 +39,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{{if .Error}}
|
||||
<div class="card mb-4 border-left-warning">
|
||||
<div class="card-body text-form-error">{{.Error}}</div>
|
||||
<div class="alert alert-warning alert-dismissible fade show" role="alert">
|
||||
{{.Error}}
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
{{end}}
|
||||
<form id="eventaction_form" action="{{.CurrentURL}}" method="POST" autocomplete="off">
|
||||
|
||||
@@ -26,8 +26,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
{{end}}
|
||||
|
||||
{{define "page_body"}}
|
||||
<div id="errorMsg" class="card mb-4 border-left-warning" style="display: none;">
|
||||
<div id="errorTxt" class="card-body text-form-error"></div>
|
||||
<div id="errorMsg" class="alert alert-warning alert-dismissible fade show" style="display: none;" role="alert">
|
||||
<span id="errorTxt"></span>
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="card shadow mb-4">
|
||||
<div class="card-header py-3">
|
||||
@@ -101,11 +104,13 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
<script type="text/javascript">
|
||||
|
||||
function deleteAction() {
|
||||
var table = $('#dataTable').DataTable();
|
||||
let table = $('#dataTable').DataTable();
|
||||
table.button('delete:name').enable(false);
|
||||
var name = table.row({ selected: true }).data()[0];
|
||||
var path = '{{.EventActionURL}}' + "/" + fixedEncodeURIComponent(name);
|
||||
let name = table.row({ selected: true }).data()[0];
|
||||
let path = '{{.EventActionURL}}' + "/" + fixedEncodeURIComponent(name);
|
||||
$('#deleteModal').modal('hide');
|
||||
$('#errorMsg').hide();
|
||||
|
||||
$.ajax({
|
||||
url: path,
|
||||
type: 'DELETE',
|
||||
@@ -129,9 +134,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
}
|
||||
$('#errorTxt').text(txt);
|
||||
$('#errorMsg').show();
|
||||
setTimeout(function () {
|
||||
$('#errorMsg').hide();
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -28,8 +28,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{{if .Error}}
|
||||
<div class="card mb-4 border-left-warning">
|
||||
<div class="card-body text-form-error">{{.Error}}</div>
|
||||
<div class="alert alert-warning alert-dismissible fade show" role="alert">
|
||||
{{.Error}}
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
{{end}}
|
||||
<form id="eventrule_form" action="{{.CurrentURL}}" method="POST" autocomplete="off">
|
||||
|
||||
@@ -26,8 +26,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
{{end}}
|
||||
|
||||
{{define "page_body"}}
|
||||
<div id="errorMsg" class="card mb-4 border-left-warning" style="display: none;">
|
||||
<div id="errorTxt" class="card-body text-form-error"></div>
|
||||
<div id="errorMsg" class="alert alert-warning alert-dismissible fade show" style="display: none;" role="alert">
|
||||
<span id="errorTxt"></span>
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div id="successMsg" class="card mb-4 border-left-success" style="display: none;">
|
||||
<div id="successTxt" class="card-body"></div>
|
||||
@@ -138,6 +141,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
let name = table.row({ selected: true }).data()[1];
|
||||
let path = '{{.EventRuleURL}}' + "/run/" + fixedEncodeURIComponent(name);
|
||||
$('#runModal').modal('hide');
|
||||
$('#successMsg').hide();
|
||||
$('#errorMsg').hide();
|
||||
|
||||
$.ajax({
|
||||
url: path,
|
||||
type: 'POST',
|
||||
@@ -165,9 +171,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
}
|
||||
$('#errorTxt').text(txt);
|
||||
$('#errorMsg').show();
|
||||
setTimeout(function () {
|
||||
$('#errorMsg').hide();
|
||||
}, 8000);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -178,6 +181,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
let name = table.row({ selected: true }).data()[1];
|
||||
let path = '{{.EventRuleURL}}' + "/" + fixedEncodeURIComponent(name);
|
||||
$('#deleteModal').modal('hide');
|
||||
$('#errorMsg').hide();
|
||||
|
||||
$.ajax({
|
||||
url: path,
|
||||
type: 'DELETE',
|
||||
@@ -201,9 +206,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
}
|
||||
$('#errorTxt').text(txt);
|
||||
$('#errorMsg').show();
|
||||
setTimeout(function () {
|
||||
$('#errorMsg').hide();
|
||||
}, 8000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -28,8 +28,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
{{end}}
|
||||
|
||||
{{define "page_body"}}
|
||||
<div id="errorMsg" class="card mb-4 border-left-warning" style="display: none;">
|
||||
<div id="errorTxt" class="card-body text-form-error"></div>
|
||||
<div id="errorMsg" class="alert alert-warning alert-dismissible fade show" style="display: none;" role="alert">
|
||||
<span id="errorTxt"></span>
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="card shadow mb-4">
|
||||
<div class="card-header py-3">
|
||||
@@ -332,6 +335,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
}
|
||||
|
||||
function initProviderDatatable(){
|
||||
$('#errorMsg').hide();
|
||||
let tableProvider = $('#dataTableProvider').DataTable({
|
||||
"ajax": {
|
||||
"url": getSearchURL(false),
|
||||
@@ -351,9 +355,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
}
|
||||
$('#errorTxt').text(txt);
|
||||
$('#errorMsg').show();
|
||||
setTimeout(function () {
|
||||
$('#errorMsg').hide();
|
||||
}, 10000);
|
||||
}
|
||||
},
|
||||
"deferRender": true,
|
||||
@@ -417,6 +418,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
}
|
||||
|
||||
function initFsDatatable(){
|
||||
$('#errorMsg').hide();
|
||||
let tableFs = $('#dataTableFs').DataTable({
|
||||
"ajax": {
|
||||
"url": getSearchURL(false),
|
||||
@@ -436,9 +438,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
}
|
||||
$('#errorTxt').text(txt);
|
||||
$('#errorMsg').show();
|
||||
setTimeout(function () {
|
||||
$('#errorMsg').hide();
|
||||
}, 10000);
|
||||
}
|
||||
},
|
||||
"deferRender": true,
|
||||
|
||||
@@ -28,8 +28,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{{if .Error}}
|
||||
<div class="card mb-4 border-left-warning">
|
||||
<div class="card-body text-form-error">{{.Error}}</div>
|
||||
<div class="alert alert-warning alert-dismissible fade show" role="alert">
|
||||
{{.Error}}
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
{{end}}
|
||||
{{if eq .Mode 3}}
|
||||
|
||||
@@ -27,8 +27,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
{{end}}
|
||||
|
||||
{{define "page_body"}}
|
||||
<div id="errorMsg" class="card mb-4 border-left-warning" style="display: none;">
|
||||
<div id="errorTxt" class="card-body text-form-error"></div>
|
||||
<div id="errorMsg" class="alert alert-warning alert-dismissible fade show" style="display: none;" role="alert">
|
||||
<span id="errorTxt"></span>
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div id="successMsg" class="card mb-4 border-left-success" style="display: none;">
|
||||
@@ -115,11 +118,13 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
<script type="text/javascript">
|
||||
|
||||
function deleteAction() {
|
||||
var table = $('#dataTable').DataTable();
|
||||
let table = $('#dataTable').DataTable();
|
||||
table.button('delete:name').enable(false);
|
||||
var folderName = table.row({ selected: true }).data()[1];
|
||||
var path = '{{.FolderURL}}' + "/" + fixedEncodeURIComponent(folderName);
|
||||
let folderName = table.row({ selected: true }).data()[1];
|
||||
let path = '{{.FolderURL}}' + "/" + fixedEncodeURIComponent(folderName);
|
||||
$('#deleteModal').modal('hide');
|
||||
$('#errorMsg').hide();
|
||||
|
||||
$.ajax({
|
||||
url: path,
|
||||
type: 'DELETE',
|
||||
@@ -143,9 +148,6 @@ function deleteAction() {
|
||||
}
|
||||
$('#errorTxt').text(txt);
|
||||
$('#errorMsg').show();
|
||||
setTimeout(function () {
|
||||
$('#errorMsg').hide();
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -217,7 +219,7 @@ function deleteAction() {
|
||||
$('#successMsg').show();
|
||||
setTimeout(function () {
|
||||
$('#successMsg').hide();
|
||||
}, 5000);
|
||||
}, 15000);
|
||||
},
|
||||
error: function ($xhr, textStatus, errorThrown) {
|
||||
dt.button('quota_scan:name').enable(true);
|
||||
@@ -234,9 +236,6 @@ function deleteAction() {
|
||||
}
|
||||
$('#errorTxt').text(txt);
|
||||
$('#errorMsg').show();
|
||||
setTimeout(function () {
|
||||
$('#errorMsg').hide();
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@@ -29,8 +29,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{{if .Error}}
|
||||
<div class="card mb-4 border-left-warning">
|
||||
<div class="card-body text-form-error">{{.Error}}</div>
|
||||
<div class="alert alert-warning alert-dismissible fade show" role="alert">
|
||||
{{.Error}}
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
{{end}}
|
||||
<div class="card mb-4 border-left-info">
|
||||
|
||||
@@ -26,8 +26,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
{{end}}
|
||||
|
||||
{{define "page_body"}}
|
||||
<div id="errorMsg" class="card mb-4 border-left-warning" style="display: none;">
|
||||
<div id="errorTxt" class="card-body text-form-error"></div>
|
||||
<div id="errorMsg" class="alert alert-warning alert-dismissible fade show" style="display: none;" role="alert">
|
||||
<span id="errorTxt"></span>
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="card shadow mb-4">
|
||||
@@ -100,11 +103,13 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
<script type="text/javascript">
|
||||
|
||||
function deleteAction() {
|
||||
var table = $('#dataTable').DataTable();
|
||||
let table = $('#dataTable').DataTable();
|
||||
table.button('delete:name').enable(false);
|
||||
var groupName = table.row({ selected: true }).data()[0];
|
||||
var path = '{{.GroupURL}}' + "/" + fixedEncodeURIComponent(groupName);
|
||||
let groupName = table.row({ selected: true }).data()[0];
|
||||
let path = '{{.GroupURL}}' + "/" + fixedEncodeURIComponent(groupName);
|
||||
$('#deleteModal').modal('hide');
|
||||
$('#errorMsg').hide();
|
||||
|
||||
$.ajax({
|
||||
url: path,
|
||||
type: 'DELETE',
|
||||
@@ -128,9 +133,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
}
|
||||
$('#errorTxt').text(txt);
|
||||
$('#errorMsg').show();
|
||||
setTimeout(function () {
|
||||
$('#errorMsg').hide();
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -29,8 +29,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{{if .Error}}
|
||||
<div class="card mb-4 border-left-warning">
|
||||
<div class="card-body text-form-error">{{.Error}}</div>
|
||||
<div class="alert alert-warning alert-dismissible fade show" role="alert">
|
||||
{{.Error}}
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
{{end}}
|
||||
<form id="iplist_form" action="{{.CurrentURL}}" method="POST" autocomplete="off">
|
||||
|
||||
@@ -27,8 +27,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
{{end}}
|
||||
|
||||
{{define "page_body"}}
|
||||
<div id="errorMsg" class="card mb-4 border-left-warning" style="display: none;">
|
||||
<div id="errorTxt" class="card-body text-form-error"></div>
|
||||
<div id="errorMsg" class="alert alert-warning alert-dismissible fade show" style="display: none;" role="alert">
|
||||
<span id="errorTxt"></span>
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="card shadow mb-4">
|
||||
<div class="card-header py-3">
|
||||
@@ -260,6 +263,8 @@ function deleteAction() {
|
||||
let selectedRow = table.row({ selected: true }).data();
|
||||
let path = '{{.IPListURL}}' + "/" + fixedEncodeURIComponent(selectedRow["type"])+"/"+ fixedEncodeURIComponent(selectedRow["ipornet"]);
|
||||
$('#deleteModal').modal('hide');
|
||||
$('#errorMsg').hide();
|
||||
|
||||
$.ajax({
|
||||
url: path,
|
||||
type: 'DELETE',
|
||||
@@ -283,9 +288,6 @@ function deleteAction() {
|
||||
}
|
||||
$('#errorTxt').text(txt);
|
||||
$('#errorMsg').show();
|
||||
setTimeout(function () {
|
||||
$('#errorMsg').hide();
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -406,9 +408,6 @@ $(document).ready(function () {
|
||||
}
|
||||
$('#errorTxt').text(txt);
|
||||
$('#errorMsg').show();
|
||||
setTimeout(function () {
|
||||
$('#errorMsg').hide();
|
||||
}, 10000);
|
||||
}
|
||||
},
|
||||
"deferRender": true,
|
||||
|
||||
@@ -22,8 +22,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
<h1 class="h4 text-gray-900 mb-4">{{.Branding.ShortName}} - {{.Version}}</h1>
|
||||
</div>
|
||||
{{if .Error}}
|
||||
<div class="card mb-4 border-left-warning">
|
||||
<div class="card-body text-form-error">{{.Error}}</div>
|
||||
<div class="alert alert-warning alert-dismissible fade show" role="alert">
|
||||
{{.Error}}
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
{{end}}
|
||||
<form id="login_form" action="{{.CurrentURL}}" method="POST"
|
||||
|
||||
@@ -24,8 +24,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{{if .Error}}
|
||||
<div class="card mb-4 border-left-warning">
|
||||
<div class="card-body text-form-error">{{.Error}}</div>
|
||||
<div class="alert alert-warning alert-dismissible fade show" role="alert">
|
||||
{{.Error}}
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
{{end}}
|
||||
<form id="restore_form" enctype="multipart/form-data" action="{{.RestorePath}}" method="POST">
|
||||
|
||||
@@ -31,8 +31,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
<div id="successTOTPMsg" class="card mb-4 border-left-success" style="display: none;">
|
||||
<div id="successTOTPTxt" class="card-body"></div>
|
||||
</div>
|
||||
<div id="errorTOTPMsg" class="card mb-4 border-left-warning" style="display: none;">
|
||||
<div id="errorTOTPTxt" class="card-body text-form-error"></div>
|
||||
<div id="errorTOTPMsg" class="alert alert-warning alert-dismissible fade show" style="display: none;" role="alert">
|
||||
<span id="errorTOTPTxt"></span>
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<p>Status: {{if .TOTPConfig.Enabled }}"Enabled". Current configuration: "{{.TOTPConfig.ConfigName}}"{{else}}"Disabled"{{end}}</p>
|
||||
@@ -90,8 +93,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
<div id="successRecCodesMsg" class="card mb-4 border-left-success" style="display: none;">
|
||||
<div id="successRecCodesTxt" class="card-body"></div>
|
||||
</div>
|
||||
<div id="errorRecCodesMsg" class="card mb-4 border-left-warning" style="display: none;">
|
||||
<div id="errorRecCodesTxt" class="card-body text-form-error"></div>
|
||||
<div id="errorRecCodesMsg" class="alert alert-warning alert-dismissible fade show" style="display: none;" role="alert">
|
||||
<span id="errorRecCodesTxt"></span>
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<p>Recovery codes are a set of one time use codes that can be used in place of the TOTP to login to the web UI. You can use them if you lose access to your phone to login to your account and disable or regenerate TOTP configuration.</p>
|
||||
@@ -152,7 +158,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
<script type="text/javascript">
|
||||
|
||||
function totpGenerate() {
|
||||
var path = "{{.GenerateTOTPURL}}";
|
||||
$('#errorTOTPMsg').hide();
|
||||
let path = "{{.GenerateTOTPURL}}";
|
||||
$.ajax({
|
||||
url: path,
|
||||
type: 'POST',
|
||||
@@ -170,9 +177,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
window.scrollTo(0, $("#idTOTPDetails").offset().top);
|
||||
},
|
||||
error: function ($xhr, textStatus, errorThrown) {
|
||||
var txt = "Failed to generate a new TOTP secret";
|
||||
let txt = "Failed to generate a new TOTP secret";
|
||||
if ($xhr) {
|
||||
var json = $xhr.responseJSON;
|
||||
let json = $xhr.responseJSON;
|
||||
if (json) {
|
||||
if (json.message){
|
||||
txt += ": " + json.message;
|
||||
@@ -183,21 +190,16 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
}
|
||||
$('#errorTOTPTxt').text(txt);
|
||||
$('#errorTOTPMsg').show();
|
||||
setTimeout(function () {
|
||||
$('#errorTOTPMsg').hide();
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function totpValidate() {
|
||||
var passcode = $('#idPasscode').val();
|
||||
$('#errorTOTPMsg').hide();
|
||||
let passcode = $('#idPasscode').val();
|
||||
if (passcode == "") {
|
||||
$('#errorTOTPTxt').text("The verification code is required");
|
||||
$('#errorTOTPMsg').show();
|
||||
setTimeout(function () {
|
||||
$('#errorTOTPMsg').hide();
|
||||
}, 5000);
|
||||
return;
|
||||
}
|
||||
var path = "{{.ValidateTOTPURL}}";
|
||||
@@ -226,15 +228,14 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
}
|
||||
$('#errorTOTPTxt').text(txt);
|
||||
$('#errorTOTPMsg').show();
|
||||
setTimeout(function () {
|
||||
$('#errorTOTPMsg').hide();
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function totpSave() {
|
||||
var path = "{{.SaveTOTPURL}}";
|
||||
let path = "{{.SaveTOTPURL}}";
|
||||
$('#errorTOTPMsg').hide();
|
||||
|
||||
$.ajax({
|
||||
url: path,
|
||||
type: 'POST',
|
||||
@@ -251,9 +252,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
}, 3000);
|
||||
},
|
||||
error: function ($xhr, textStatus, errorThrown) {
|
||||
var txt = "Failed to save the new configuration";
|
||||
let txt = "Failed to save the new configuration";
|
||||
if ($xhr) {
|
||||
var json = $xhr.responseJSON;
|
||||
let json = $xhr.responseJSON;
|
||||
if (json) {
|
||||
if (json.message){
|
||||
txt += ": " + json.message;
|
||||
@@ -264,9 +265,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
}
|
||||
$('#errorTOTPTxt').text(txt);
|
||||
$('#errorTOTPMsg').show();
|
||||
setTimeout(function () {
|
||||
$('#errorTOTPMsg').hide();
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -277,7 +275,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
function totpDisable() {
|
||||
$('#disableTOTPModal').modal('hide');
|
||||
var path = "{{.SaveTOTPURL}}";
|
||||
$('#errorTOTPMsg').hide();
|
||||
let path = "{{.SaveTOTPURL}}";
|
||||
|
||||
$.ajax({
|
||||
url: path,
|
||||
type: 'POST',
|
||||
@@ -303,15 +303,14 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
}
|
||||
$('#errorTOTPTxt').text(txt);
|
||||
$('#errorTOTPMsg').show();
|
||||
setTimeout(function () {
|
||||
$('#errorTOTPMsg').hide();
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getRecoveryCodes() {
|
||||
var path = "{{.RecCodesURL}}";
|
||||
$('#errorRecCodesMsg').hide();
|
||||
let path = "{{.RecCodesURL}}";
|
||||
|
||||
$.ajax({
|
||||
url: path,
|
||||
type: 'GET',
|
||||
@@ -331,9 +330,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
window.scrollTo(0, $("#idRecoveryCodesCard").offset().top);
|
||||
},
|
||||
error: function ($xhr, textStatus, errorThrown) {
|
||||
var txt = "Failed to get your recovery codes";
|
||||
let txt = "Failed to get your recovery codes";
|
||||
if ($xhr) {
|
||||
var json = $xhr.responseJSON;
|
||||
let json = $xhr.responseJSON;
|
||||
if (json) {
|
||||
if (json.message){
|
||||
txt += ": " + json.message;
|
||||
@@ -344,15 +343,15 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
}
|
||||
$('#errorRecCodesTxt').text(txt);
|
||||
$('#errorRecCodesMsg').show();
|
||||
setTimeout(function () {
|
||||
$('#errorRecCodesMsg').hide();
|
||||
}, 8000);
|
||||
window.scrollTo(0, $("#idRecoveryCodesCard").offset().top);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function generateRecoveryCodes() {
|
||||
var path = "{{.RecCodesURL}}";
|
||||
$('#errorRecCodesMsg').hide();
|
||||
let path = "{{.RecCodesURL}}";
|
||||
|
||||
$.ajax({
|
||||
url: path,
|
||||
type: 'POST',
|
||||
@@ -375,9 +374,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
}, 5000);
|
||||
},
|
||||
error: function ($xhr, textStatus, errorThrown) {
|
||||
var txt = "Failed to generate new recovery codes";
|
||||
let txt = "Failed to generate new recovery codes";
|
||||
if ($xhr) {
|
||||
var json = $xhr.responseJSON;
|
||||
let json = $xhr.responseJSON;
|
||||
if (json) {
|
||||
if (json.message){
|
||||
txt += ": " + json.message;
|
||||
@@ -388,9 +387,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
}
|
||||
$('#errorRecCodesTxt').text(txt);
|
||||
$('#errorRecCodesMsg').show();
|
||||
setTimeout(function () {
|
||||
$('#errorRecCodesMsg').hide();
|
||||
}, 8000);
|
||||
window.scrollTo(0, $("#idRecoveryCodesCard").offset().top);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -25,8 +25,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{{if .Error}}
|
||||
<div class="card mb-4 border-left-warning">
|
||||
<div class="card-body text-form-error">{{.Error}}</div>
|
||||
<div class="alert alert-warning alert-dismissible fade show" role="alert">
|
||||
{{.Error}}
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
{{end}}
|
||||
<form id="profile_form" action="{{.CurrentURL}}" method="POST">
|
||||
|
||||
@@ -25,8 +25,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{{if .Error}}
|
||||
<div class="card mb-4 border-left-warning">
|
||||
<div class="card-body text-form-error">{{.Error}}</div>
|
||||
<div class="alert alert-warning alert-dismissible fade show" role="alert">
|
||||
{{.Error}}
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
{{end}}
|
||||
<form id="role_form" action="{{.CurrentURL}}" method="POST" autocomplete="off">
|
||||
|
||||
@@ -26,8 +26,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
{{end}}
|
||||
|
||||
{{define "page_body"}}
|
||||
<div id="errorMsg" class="card mb-4 border-left-warning" style="display: none;">
|
||||
<div id="errorTxt" class="card-body text-form-error"></div>
|
||||
<div id="errorMsg" class="alert alert-warning alert-dismissible fade show" style="display: none;" role="alert">
|
||||
<span id="errorTxt"></span>
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="card shadow mb-4">
|
||||
@@ -100,11 +103,13 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
<script type="text/javascript">
|
||||
|
||||
function deleteAction() {
|
||||
var table = $('#dataTable').DataTable();
|
||||
let table = $('#dataTable').DataTable();
|
||||
table.button('delete:name').enable(false);
|
||||
var roleName = table.row({ selected: true }).data()[0];
|
||||
var path = '{{.RoleURL}}' + "/" + fixedEncodeURIComponent(roleName);
|
||||
let roleName = table.row({ selected: true }).data()[0];
|
||||
let path = '{{.RoleURL}}' + "/" + fixedEncodeURIComponent(roleName);
|
||||
$('#deleteModal').modal('hide');
|
||||
$('#errorMsg').hide();
|
||||
|
||||
$.ajax({
|
||||
url: path,
|
||||
type: 'DELETE',
|
||||
@@ -128,9 +133,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
}
|
||||
$('#errorTxt').text(txt);
|
||||
$('#errorMsg').show();
|
||||
setTimeout(function () {
|
||||
$('#errorMsg').hide();
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -22,8 +22,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
<h1 class="h4 text-gray-900 mb-4">{{.Branding.Name}} - {{.Version}}</h1>
|
||||
</div>
|
||||
{{if .Error}}
|
||||
<div class="card mb-4 border-left-warning">
|
||||
<div class="card-body text-form-error">{{.Error}}</div>
|
||||
<div class="alert alert-warning alert-dismissible fade show" role="alert">
|
||||
{{.Error}}
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
{{end}}
|
||||
<form id="login_form" action="{{.CurrentURL}}" method="POST" autocomplete="off"
|
||||
|
||||
@@ -22,8 +22,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
<h1 class="h4 text-gray-900 mb-4">{{.Branding.Name}} - {{.Version}}</h1>
|
||||
</div>
|
||||
{{if .Error}}
|
||||
<div class="card mb-4 border-left-warning">
|
||||
<div class="card-body text-form-error">{{.Error}}</div>
|
||||
<div class="alert alert-warning alert-dismissible fade show" role="alert">
|
||||
{{.Error}}
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
{{end}}
|
||||
<form id="login_form" action="{{.CurrentURL}}" method="POST" autocomplete="off"
|
||||
|
||||
@@ -31,8 +31,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{{if .Error}}
|
||||
<div class="card mb-4 border-left-warning">
|
||||
<div class="card-body text-form-error">{{.Error}}</div>
|
||||
<div class="alert alert-warning alert-dismissible fade show" role="alert">
|
||||
{{.Error}}
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
{{end}}
|
||||
{{if eq .Mode 3}}
|
||||
|
||||
@@ -28,8 +28,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
{{define "page_body"}}
|
||||
|
||||
<div id="errorMsg" class="card mb-4 border-left-warning" style="display: none;">
|
||||
<div id="errorTxt" class="card-body text-form-error"></div>
|
||||
<div id="errorMsg" class="alert alert-warning alert-dismissible fade show" style="display: none;" role="alert">
|
||||
<span id="errorTxt"></span>
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div id="successMsg" class="card mb-4 border-left-success" style="display: none;">
|
||||
@@ -130,11 +133,13 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
<script type="text/javascript">
|
||||
|
||||
function deleteAction() {
|
||||
var table = $('#dataTable').DataTable();
|
||||
let table = $('#dataTable').DataTable();
|
||||
table.button('delete:name').enable(false);
|
||||
var username = table.row({ selected: true }).data()[1];
|
||||
var path = '{{.UserURL}}' + "/" + fixedEncodeURIComponent(username);
|
||||
let username = table.row({ selected: true }).data()[1];
|
||||
let path = '{{.UserURL}}' + "/" + fixedEncodeURIComponent(username);
|
||||
$('#deleteModal').modal('hide');
|
||||
$('#errorMsg').hide();
|
||||
|
||||
$.ajax({
|
||||
url: path,
|
||||
type: 'DELETE',
|
||||
@@ -158,9 +163,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
}
|
||||
$('#errorTxt').text(txt);
|
||||
$('#errorMsg').show();
|
||||
setTimeout(function () {
|
||||
$('#errorMsg').hide();
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -237,7 +239,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
$('#successMsg').show();
|
||||
setTimeout(function () {
|
||||
$('#successMsg').hide();
|
||||
}, 5000);
|
||||
}, 15000);
|
||||
},
|
||||
error: function ($xhr, textStatus, errorThrown) {
|
||||
dt.button('quota_scan:name').enable(true);
|
||||
@@ -254,9 +256,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
}
|
||||
$('#errorTxt').text(txt);
|
||||
$('#errorMsg').show();
|
||||
setTimeout(function () {
|
||||
$('#errorMsg').hide();
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user