summaryrefslogtreecommitdiff
path: root/js/PrefUsers.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-03-01 15:24:18 +0300
committerAndrew Dolgov <[email protected]>2021-03-01 15:24:18 +0300
commit6359259dbb1e8d5b569f569a7089abffd9259d30 (patch)
tree69fc8e95b55d4c9ab0e3345e6f52d3c5632f038a /js/PrefUsers.js
parent320503dd3911de93d059ebe1ba8b96004d8f6b03 (diff)
simplify internal authentication code and bump default algo to SSHA-512
Diffstat (limited to 'js/PrefUsers.js')
-rw-r--r--js/PrefUsers.js27
1 files changed, 16 insertions, 11 deletions
diff --git a/js/PrefUsers.js b/js/PrefUsers.js
index 3eb83b02a..109782f6c 100644
--- a/js/PrefUsers.js
+++ b/js/PrefUsers.js
@@ -1,16 +1,18 @@
'use strict'
-/* global __ */
-/* global xhrPost, xhr, dijit, Notify, Tables, App, fox */
+/* global __, xhr, dijit, Notify, Tables, App, fox */
const Users = {
reload: function(sort) {
- const user_search = App.byId("user_search");
- const search = user_search ? user_search.value : "";
+ return new Promise((resolve, reject) => {
+ const user_search = App.byId("user_search");
+ const search = user_search ? user_search.value : "";
- xhr.post("backend.php", { op: "pref-users", sort: sort, search: search }, (reply) => {
- dijit.byId('usersTab').attr('content', reply);
- Notify.close();
+ xhr.post("backend.php", { op: "pref-users", sort: sort, search: search }, (reply) => {
+ dijit.byId('usersTab').attr('content', reply);
+ Notify.close();
+ resolve();
+ }, (e) => { reject(e) });
});
},
add: function() {
@@ -20,8 +22,9 @@ const Users = {
Notify.progress("Adding user...");
xhr.post("backend.php", {op: "pref-users", method: "add", login: login}, (reply) => {
- alert(reply);
- Users.reload();
+ Users.reload().then(() => {
+ Notify.info(reply);
+ })
});
}
@@ -38,9 +41,11 @@ const Users = {
if (this.validate()) {
Notify.progress("Saving data...", true);
- xhr.post("backend.php", this.attr('value'), () => {
+ xhr.post("backend.php", this.attr('value'), (reply) => {
dialog.hide();
- Users.reload();
+ Users.reload().then(() => {
+ Notify.info(reply);
+ });
});
}
},