From 661254b76edd51c36090edd0f898bdca16f23277 Mon Sep 17 00:00:00 2001 From: Javier Sánchez Parra Date: Tue, 26 Apr 2022 17:16:52 +0200 Subject: Add 'Add user' to Users section Creates "Add user" form with the following inputs: username, password, password confirmation, role (administrator or regular), allowed scopes. --- ogcp/static/js/ogcp.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'ogcp/static') 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() + }); +} -- cgit v1.2.3-18-g5258