aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--interface/js/app/rspamd.js34
1 files changed, 12 insertions, 22 deletions
diff --git a/interface/js/app/rspamd.js b/interface/js/app/rspamd.js
index 06d9a46f9..031a86a86 100644
--- a/interface/js/app/rspamd.js
+++ b/interface/js/app/rspamd.js
@@ -195,15 +195,7 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config,
var req_params = {
jsonp: false,
data: o.data,
- beforeSend: function (xhr) {
- xhr.setRequestHeader("Password", getPassword());
-
- if (o.headers) {
- $.each(o.headers, function (hname, hvalue) {
- xhr.setRequestHeader(hname, hvalue);
- });
- }
- },
+ headers: $.extend({Password: getPassword()}, o.headers),
url: neighbours_status[ind].url + req_url,
success: function (json) {
neighbours_status[ind].checked = true;
@@ -323,21 +315,15 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config,
return;
}
- $.ajax({
- global: false,
- jsonp: false,
- dataType: "json",
- type: "GET",
- url: "auth",
- beforeSend: function (xhr) {
- xhr.setRequestHeader("Password", password);
+ ui.query("auth", {
+ headers: {
+ Password: password
},
success: function (json) {
+ var data = json[0].data;
$("#connectPassword").val("");
- if (json.auth === "failed") {
- // Is actually never returned by Rspamd
- } else {
- sessionStorage.setItem("read_only", json.read_only);
+ if (data.auth === "ok") {
+ sessionStorage.setItem("read_only", data.read_only);
saveCredentials(password);
$(dialog).hide();
$(backdrop).hide();
@@ -348,7 +334,11 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config,
ui.alertMessage("alert-modal alert-error", jqXHR.statusText);
$("#connectPassword").val("");
$("#connectPassword").focus();
- }
+ },
+ params: {
+ global: false,
+ },
+ server: "local"
});
});
};