fix api-key edit (thx Davidd), fix dns-editor ttl field (thx Rolf)

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-12-05 20:58:57 +01:00
parent 5b7a76b608
commit 609c15688c
3 changed files with 11 additions and 9 deletions

View File

@@ -46,7 +46,7 @@ $record = isset($_POST['dns_record']) ? trim($_POST['dns_record']) : null;
$type = isset($_POST['dns_type']) ? $_POST['dns_type'] : 'A';
$prio = isset($_POST['dns_mxp']) ? (int)$_POST['dns_mxp'] : null;
$content = isset($_POST['dns_content']) ? trim($_POST['dns_content']) : null;
$ttl = isset($_POST['record']['ttl']) ? (int)$_POST['record']['ttl'] : 18000;
$ttl = isset($_POST['dns_ttl']) ? (int)$_POST['dns_ttl'] : 18000;
// get domain-name
$domain = Dns::getAllowedDomainEntry($domain_id, AREA, $userinfo);

View File

@@ -268,8 +268,7 @@ class Ajax
$_check_list = $ip_list;
foreach ($_check_list as $idx => $ip) {
if (Validate::validate_ip2($ip, true, 'invalidip', true, true, true) == false) {
unset($ip_list[$idx]);
continue;
return $this->errorResponse('Invalid ip address', 406);
}
// check for cidr
if (strpos($ip, '/') !== false) {

View File

@@ -5,12 +5,12 @@ $(function () {
var _this = $(this);
clearTimeout(timer);
timer = setTimeout(function () {
var akid = $('div[data-action="apikeys"]').data('entry');
var akid = _this.closest('div[data-action="apikeys"]').data('entry');
$.ajax({
url: "lib/ajax.php?action=editapikey",
type: "POST",
dataType: "json",
data: { id: akid, allowed_from: _this.val(), valid_until: $('div[data-action="apikeys"] #valid_until').val() },
data: { id: akid, allowed_from: _this.val(), valid_until: $('div[data-entry="' + akid + '"] #valid_until').val() },
success: function (data) {
if (data.message) {
_this.removeClass('is-valid');
@@ -22,7 +22,8 @@ $(function () {
}
},
error: function (request, status, error) {
console.log(request, status, error)
_this.removeClass('is-valid');
_this.addClass('is-invalid');
}
});
}, delay);
@@ -32,12 +33,12 @@ $(function () {
var _this = $(this);
clearTimeout(timer);
timer = setTimeout(function () {
var akid = $('div[data-action="apikeys"]').data('entry');
var akid = _this.closest('div[data-action="apikeys"]').data('entry');
$.ajax({
url: "lib/ajax.php?action=editapikey",
type: "POST",
dataType: "json",
data: { id: akid, valid_until: _this.val(), allowed_from: $('div[data-action="apikeys"] #allowed_from').val() },
data: { id: akid, valid_until: _this.val(), allowed_from: $('div[data-entry="' + akid + '"] #allowed_from').val() },
success: function (data) {
if (data.message) {
_this.removeClass('is-valid');
@@ -49,9 +50,11 @@ $(function () {
}
},
error: function (request, status, error) {
console.log(request, status, error)
_this.removeClass('is-valid');
_this.addClass('is-invalid');
}
});
}, delay);
});
});