diff options
author | Marcin Łojewski <marcin.lojewski@mlojewski.me> | 2018-12-24 16:47:55 +0300 |
---|---|---|
committer | Marcin Łojewski <marcin.lojewski@mlojewski.me> | 2018-12-24 16:47:55 +0300 |
commit | 5045c7d931ad1fb13b948993166ade6a39602c32 (patch) | |
tree | d74bc2a9283da035d933fa78a57a72576e964a20 | |
parent | 436c1d930d154af7bda9a93f3a6b83cd85656d17 (diff) |
Setting crypto params from admin panel pt II
-rw-r--r-- | css/settings.css | 9 | ||||
-rw-r--r-- | js/settings.js | 6 | ||||
-rw-r--r-- | lib/Controller/SettingsController.php | 14 |
3 files changed, 19 insertions, 10 deletions
diff --git a/css/settings.css b/css/settings.css index 33f454a..61f1a41 100644 --- a/css/settings.css +++ b/css/settings.css @@ -55,4 +55,11 @@ #user_sql .msg.waiting { background-color: #ff8f00; color: #fff; -}
\ No newline at end of file +} + +#user_sql .loading { + display: inline-block; + height: 32px; + margin: 5px 0; + width: 32px; +} diff --git a/js/settings.js b/js/settings.js index a0f6b14..52e4d38 100644 --- a/js/settings.js +++ b/js/settings.js @@ -62,15 +62,17 @@ user_sql.adminSettingsUI = function () { var cryptoChanged = function () { var div = $("#opt-crypto_params"); div.empty(); + div.append("<span class=\"icon loading\"></span>"); var cryptoClass = $("#opt-crypto_class").val(); $.get(OC.generateUrl("/apps/user_sql/settings/crypto/params"), cryptoClass, function (data) { + div.empty(); if (data.status === "success") { for (var index = 0, length = data.data.length; index < length; ++index) { div.append("<div><label for=\"opt-crypto_param_" + index + "\"><span>" - + data.data[index]["visible_name"] + + data.data[index]["name"] + "</span><input type=\"number\" id=\"opt-crypto_param_" + index + "\" name=\"opt-crypto_param_" @@ -80,7 +82,7 @@ user_sql.adminSettingsUI = function () { + "\" max=\"" + data.data[index]["max"] + "\" value=\"" - + data.data[index]["default"] // TODO set current + + data.data[index]["value"] + "\"></label></div>"); } } diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php index a590a08..2beb36c 100644 --- a/lib/Controller/SettingsController.php +++ b/lib/Controller/SettingsController.php @@ -375,25 +375,25 @@ class SettingsController extends Controller */ public function cryptoParams() { + sleep(3); // TODO implement // TODO add current values return [ "status" => "success", "data" => [ [ - "name" => "memoryCost", - "visible_name" => "Memory cost (KiB)", - "default" => PASSWORD_ARGON2_DEFAULT_MEMORY_COST, + "name" => "Memory cost (KiB)", + "value" => PASSWORD_ARGON2_DEFAULT_MEMORY_COST, "min" => 1, "max" => 1048576 ], [ - "name" => "timeCost", "visible_name" => "Time cost", - "default" => PASSWORD_ARGON2_DEFAULT_TIME_COST, "min" => 1, + "name" => "Time cost", + "value" => PASSWORD_ARGON2_DEFAULT_TIME_COST, "min" => 1, "max" => 1024 ], [ - "name" => "threads", "visible_name" => "Threads", - "default" => PASSWORD_ARGON2_DEFAULT_THREADS, "min" => 1, + "name" => "Threads", + "value" => PASSWORD_ARGON2_DEFAULT_THREADS, "min" => 1, "max" => 1024 ] ] |