mirror of
https://github.com/pi-hole/web.git
synced 2025-12-24 12:48:29 +00:00
Prevent users from adding empty groups/domains/clients/adlists.
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
@@ -9,19 +9,35 @@ function showAlert(type, icon, message) {
|
||||
info = $.notify({
|
||||
type: "info",
|
||||
icon: "glyphicon glyphicon-time",
|
||||
message: message
|
||||
message: " " + message
|
||||
});
|
||||
break;
|
||||
case "success":
|
||||
msg = "Successfully " + message;
|
||||
msg = " Successfully " + message;
|
||||
if (info) {
|
||||
info.update({ type: "success", icon: icon, message: msg });
|
||||
} else {
|
||||
$.notify({ type: "success", icon: icon, message: msg });
|
||||
}
|
||||
break;
|
||||
case "warning":
|
||||
msg = " " + 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 = " Error, something went wrong!<br><pre>" + message + "</pre>";
|
||||
if (info) {
|
||||
info.update({
|
||||
type: "danger",
|
||||
@@ -133,6 +149,12 @@ function addGroup() {
|
||||
var desc = $("#new_desc").val();
|
||||
|
||||
showAlert("info", "", "Adding group " + name + "...");
|
||||
|
||||
if (name.length === 0) {
|
||||
showAlert("warning", "", "Please specify a group name");
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: "scripts/pi-hole/php/groups.php",
|
||||
method: "post",
|
||||
|
||||
Reference in New Issue
Block a user