diff --git a/DnsServerCore/www/js/main.js b/DnsServerCore/www/js/main.js index 2dccc8dc..6ceae45d 100644 --- a/DnsServerCore/www/js/main.js +++ b/DnsServerCore/www/js/main.js @@ -378,7 +378,7 @@ function login(username, password) { var btn = $("#btnLogin").button('loading'); HTTPRequest({ - url: "/api/login?user=" + username + "&pass=" + password, + url: "/api/login?user=" + encodeURIComponent(username) + "&pass=" + encodeURIComponent(password), success: function (responseJSON) { token = responseJSON.token; @@ -449,7 +449,7 @@ function changePassword() { var btn = $("#btnChangePasswordSave").button('loading'); HTTPRequest({ - url: "/api/changePassword?token=" + token + "&pass=" + newPassword, + url: "/api/changePassword?token=" + token + "&pass=" + encodeURIComponent(newPassword), success: function (responseJSON) { $("#modalChangePassword").modal("hide"); btn.button('reset'); @@ -682,7 +682,7 @@ function saveDnsSettings() { proxy = "&proxyType=" + proxyType; } else { - proxy = "&proxyType=" + proxyType + "&proxyAddress=" + $("#txtProxyAddress").val() + "&proxyPort=" + $("#txtProxyPort").val() + "&proxyUsername=" + $("#txtProxyUsername").val() + "&proxyPassword=" + $("#txtProxyPassword").val(); + proxy = "&proxyType=" + proxyType + "&proxyAddress=" + $("#txtProxyAddress").val() + "&proxyPort=" + $("#txtProxyPort").val() + "&proxyUsername=" + encodeURIComponent($("#txtProxyUsername").val()) + "&proxyPassword=" + encodeURIComponent($("#txtProxyPassword").val()); } var forwarders = cleanTextList($("#txtForwarders").val()); @@ -696,18 +696,15 @@ function saveDnsSettings() { var blockListUrls = cleanTextList($("#txtBlockListUrls").val()); - if ((blockListUrls.length === 0) || (blockListUrls === ",")) { + if ((blockListUrls.length === 0) || (blockListUrls === ",")) blockListUrls = false; - } - else { + else $("#txtBlockListUrls").val(blockListUrls.replace(/,/g, "\n") + "\n"); - blockListUrls = window.btoa(blockListUrls); - } var btn = $("#btnSaveDnsSettings").button('loading'); HTTPRequest({ - url: "/api/setDnsSettings?token=" + token + "&serverDomain=" + serverDomain + "&webServicePort=" + webServicePort + "&dnsServerLocalAddresses=" + dnsServerLocalAddresses + "&preferIPv6=" + preferIPv6 + "&logQueries=" + logQueries + "&allowRecursion=" + allowRecursion + "&allowRecursionOnlyForPrivateNetworks=" + allowRecursionOnlyForPrivateNetworks + proxy + "&forwarders=" + forwarders + "&forwarderProtocol=" + forwarderProtocol + "&blockListUrls=" + blockListUrls, + url: "/api/setDnsSettings?token=" + token + "&serverDomain=" + serverDomain + "&webServicePort=" + webServicePort + "&dnsServerLocalAddresses=" + encodeURIComponent(dnsServerLocalAddresses) + "&preferIPv6=" + preferIPv6 + "&logQueries=" + logQueries + "&allowRecursion=" + allowRecursion + "&allowRecursionOnlyForPrivateNetworks=" + allowRecursionOnlyForPrivateNetworks + proxy + "&forwarders=" + encodeURIComponent(forwarders) + "&forwarderProtocol=" + forwarderProtocol + "&blockListUrls=" + encodeURIComponent(blockListUrls), success: function (responseJSON) { document.title = "Technitium DNS Server " + responseJSON.response.version + " - " + responseJSON.response.serverDomain; $("#lblServerDomain").text(" - " + responseJSON.response.serverDomain); @@ -1623,13 +1620,13 @@ function renderStandardResourceRecord(record, domain) { html += "