diff options
author | Javier Sánchez Parra <jsanchez@soleta.eu> | 2022-04-26 17:16:52 +0200 |
---|---|---|
committer | Javier Sánchez Parra <jsanchez@soleta.eu> | 2022-04-27 17:27:50 +0200 |
commit | 661254b76edd51c36090edd0f898bdca16f23277 (patch) | |
tree | 7882d0097515358435206a795d4f8b815965f529 /ogcp/static | |
parent | d8bac16a980634f182e9c753a01e114c3a482af0 (diff) |
Add 'Add user' to Users section
Creates "Add user" form with the following inputs: username, password,
password confirmation, role (administrator or regular), allowed scopes.
Diffstat (limited to 'ogcp/static')
-rw-r--r-- | ogcp/static/js/ogcp.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/ogcp/static/js/ogcp.js b/ogcp/static/js/ogcp.js index 6a7e625..4605e5d 100644 --- a/ogcp/static/js/ogcp.js +++ b/ogcp/static/js/ogcp.js @@ -231,3 +231,25 @@ function digestLoginPassword() { $(this).submit() }); } + +function digestUserFormPassword() { + const loginForm = $('#user-form') + loginForm.one('submit', async function (event) { + event.preventDefault() + + const pwdInput = $('#pwd'); + const pwdHashInput = $('#pwd_hash'); + const pwdStr = pwdInput.val(); + const pwdStrHash = await digestMessage(pwdStr); + + const pwdConfirmInput = $('#pwd_confirm'); + const pwdHashConfirmInput = $('#pwd_hash_confirm'); + const pwdConfirmStr = pwdConfirmInput.val(); + const pwdConfirmStrHash = await digestMessage(pwdConfirmStr); + + pwdInput.prop( "disabled", true ); + pwdHashInput.val(pwdStrHash); + pwdHashConfirmInput.val(pwdConfirmStrHash); + $(this).submit() + }); +} |