Prevent users from adding empty groups/domains/clients/adlists.

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2019-12-17 12:57:45 +00:00
parent d0d1174010
commit da2d92ebd7
4 changed files with 100 additions and 12 deletions

View File

@@ -10,19 +10,35 @@ function showAlert(type, icon, message) {
info = $.notify({
type: "info",
icon: "glyphicon glyphicon-time",
message: message
message: "&nbsp;" + message
});
break;
case "success":
msg = "Successfully " + message;
msg = "&nbsp;Successfully " + message;
if (info) {
info.update({ type: "success", icon: icon, message: msg });
} else {
$.notify({ type: "success", icon: icon, message: msg });
}
break;
case "warning":
msg = "&nbsp;" + message;
if (info) {
info.update({
type: "warning",
icon: "glyphicon glyphicon-warning-sign",
message: msg
});
} else {
$.notify({
type: "warning",
icon: "glyphicon glyphicon-warning-sign",
message: msg
});
}
break;
case "error":
msg = "Error, something went wrong!<br><pre>" + message + "</pre>";
msg = "&nbsp;Error, something went wrong!<br><pre>" + message + "</pre>";
if (info) {
info.update({
type: "danger",
@@ -192,6 +208,12 @@ function addClient() {
}
showAlert("info", "", "Adding client " + ip + "...");
if (ip.length === 0) {
showAlert("warning", "", "Please specify a client");
return;
}
$.ajax({
url: "scripts/pi-hole/php/groups.php",
method: "post",