mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 11:42:55 +02:00
don't validate category inputs for empty
This commit is contained in:
parent
015aafe0fb
commit
1474f22fd7
1 changed files with 25 additions and 27 deletions
|
@ -908,7 +908,7 @@ function validateInputs() {
|
||||||
}
|
}
|
||||||
|
|
||||||
_.each(tables, function(table) {
|
_.each(tables, function(table) {
|
||||||
var inputs = $(table).find('tr.' + Settings.NEW_ROW_CLASS + ' input[data-changed="true"]');
|
var inputs = $(table).find('tr.' + Settings.NEW_ROW_CLASS + ':not([data-category]) input[data-changed="true"]');
|
||||||
|
|
||||||
var empty = false;
|
var empty = false;
|
||||||
|
|
||||||
|
@ -917,6 +917,7 @@ function validateInputs() {
|
||||||
|
|
||||||
if (inputVal.length === 0) {
|
if (inputVal.length === 0) {
|
||||||
empty = true
|
empty = true
|
||||||
|
|
||||||
markParentRowInvalid(input);
|
markParentRowInvalid(input);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -984,25 +985,7 @@ var SETTINGS_ERROR_MESSAGE = "There was a problem saving domain settings. Please
|
||||||
|
|
||||||
function saveSettings() {
|
function saveSettings() {
|
||||||
|
|
||||||
// verify that the password and confirmation match before saving
|
if (validateInputs()) {
|
||||||
var canPost = true;
|
|
||||||
|
|
||||||
if (formJSON["security"]) {
|
|
||||||
var password = formJSON["security"]["http_password"];
|
|
||||||
var verify_password = formJSON["security"]["verify_http_password"];
|
|
||||||
|
|
||||||
if (password && password.length > 0) {
|
|
||||||
if (password != verify_password) {
|
|
||||||
bootbox.alert({"message": "Passwords must match!", "title":"Password Error"});
|
|
||||||
canPost = false;
|
|
||||||
} else {
|
|
||||||
formJSON["security"]["http_password"] = sha256_digest(password);
|
|
||||||
delete formJSON["security"]["verify_http_password"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (canPost && validateInputs()) {
|
|
||||||
// POST the form JSON to the domain-server settings.json endpoint so the settings are saved
|
// POST the form JSON to the domain-server settings.json endpoint so the settings are saved
|
||||||
|
|
||||||
// disable any inputs not changed
|
// disable any inputs not changed
|
||||||
|
@ -1021,6 +1004,24 @@ function saveSettings() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// verify that the password and confirmation match before saving
|
||||||
|
var canPost = true;
|
||||||
|
|
||||||
|
if (formJSON["security"]) {
|
||||||
|
var password = formJSON["security"]["http_password"];
|
||||||
|
var verify_password = formJSON["security"]["verify_http_password"];
|
||||||
|
|
||||||
|
if (password && password.length > 0) {
|
||||||
|
if (password != verify_password) {
|
||||||
|
bootbox.alert({"message": "Passwords must match!", "title":"Password Error"});
|
||||||
|
canPost = false;
|
||||||
|
} else {
|
||||||
|
formJSON["security"]["http_password"] = sha256_digest(password);
|
||||||
|
delete formJSON["security"]["verify_http_password"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
console.log("----- SAVING ------");
|
console.log("----- SAVING ------");
|
||||||
console.log(formJSON);
|
console.log(formJSON);
|
||||||
|
|
||||||
|
@ -1032,16 +1033,13 @@ function saveSettings() {
|
||||||
// remove focus from the button
|
// remove focus from the button
|
||||||
$(this).blur();
|
$(this).blur();
|
||||||
|
|
||||||
// POST the form JSON to the domain-server settings.json endpoint so the settings are saved
|
if (canPost) {
|
||||||
postSettings(formJSON);
|
// POST the form JSON to the domain-server settings.json endpoint so the settings are saved
|
||||||
|
postSettings(formJSON);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// disable any inputs not changed
|
|
||||||
$("input:not([data-changed])").each(function(){
|
|
||||||
$(this).prop('disabled', true);
|
|
||||||
});
|
|
||||||
|
|
||||||
$('body').on('click', '.save-button', function(e){
|
$('body').on('click', '.save-button', function(e){
|
||||||
saveSettings();
|
saveSettings();
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue