summaryrefslogtreecommitdiffstats
path: root/interface/js
diff options
context:
space:
mode:
authorAlexander Moisseev <moiseev@mezonplus.ru>2018-08-15 15:03:09 +0300
committerAlexander Moisseev <moiseev@mezonplus.ru>2018-08-15 15:03:09 +0300
commit2b551f3a4ab14f8cef85a6756325bfddffc2b957 (patch)
treec5c61641ec589e9bb7d2367cde4236d85af30c11 /interface/js
parenta464f991e25309e0200eebb6ab3aa2da2ffa1d85 (diff)
downloadrspamd-2b551f3a4ab14f8cef85a6756325bfddffc2b957.tar.gz
rspamd-2b551f3a4ab14f8cef85a6756325bfddffc2b957.zip
[Minor] Use query function for authentication
Diffstat (limited to 'interface/js')
-rw-r--r--interface/js/app/rspamd.js24
1 files changed, 11 insertions, 13 deletions
diff --git a/interface/js/app/rspamd.js b/interface/js/app/rspamd.js
index 32a1ad297..031a86a86 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"
});
});
};