diff options
author | Simon Rettberg | 2018-04-09 18:09:07 +0200 |
---|---|---|
committer | Simon Rettberg | 2018-04-09 18:09:07 +0200 |
commit | 1a4c38fddc0003ca36e2c3838b5a4c9233d51a35 (patch) | |
tree | a2a3717f1571e1b67257fd97c68561517505298c /modules-available/adduser/templates/js-add-edit.html | |
parent | [adduser] Rename permission to view-list (diff) | |
download | slx-admin-1a4c38fddc0003ca36e2c3838b5a4c9233d51a35.tar.gz slx-admin-1a4c38fddc0003ca36e2c3838b5a4c9233d51a35.tar.xz slx-admin-1a4c38fddc0003ca36e2c3838b5a4c9233d51a35.zip |
[adduser] JS checks while editing user; second save button below role list
Diffstat (limited to 'modules-available/adduser/templates/js-add-edit.html')
-rw-r--r-- | modules-available/adduser/templates/js-add-edit.html | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/modules-available/adduser/templates/js-add-edit.html b/modules-available/adduser/templates/js-add-edit.html new file mode 100644 index 00000000..95454c22 --- /dev/null +++ b/modules-available/adduser/templates/js-add-edit.html @@ -0,0 +1,26 @@ +<script><!-- +document.addEventListener('DOMContentLoaded', function() { + var $login = $('#login'); + var $pass1 = $('#pass1'); + var $pass2 = $('#pass2'); + var $fullname = $('#fullname'); + var $msg = $('#add-msg'); + var $btn = $('.save-btn'); + var ev = function() { + var msg = ''; + if ($login.val().length < 2) { + msg = '{{lang_loginTooShort}}'; + } else if ($pass1.val() !== $pass2.val()) { + msg = '{{lang_passwordsDontMatch}}'; + } else if ((!SLX_EDITUSER || $pass1.val().length > 0) && $pass1.val().length < 2) { + msg = '{{lang_passwordTooShort}}'; + } else if ($fullname.val().length < 1) { + msg = '{{lang_fullnameMissing}}'; + } + $msg.text(msg); + $btn.prop('disabled', !!msg); + }; + $('.event-box').change(ev).keyup(ev); + if (SLX_EDITUSER) ev(); +}); +//--></script>
\ No newline at end of file |