From: Alexander Moisseev Date: Wed, 15 Aug 2018 12:03:09 +0000 (+0300) Subject: [Minor] Use query function for authentication X-Git-Tag: 1.8.0~255^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F2422%2Fhead;p=thirdparty%2Frspamd.git [Minor] Use query function for authentication --- diff --git a/interface/js/app/rspamd.js b/interface/js/app/rspamd.js index 32a1ad297e..031a86a86e 100644 --- a/interface/js/app/rspamd.js +++ b/interface/js/app/rspamd.js @@ -315,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(); @@ -340,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" }); }); };