diff options
Diffstat (limited to 'ogcp/static/js')
-rw-r--r-- | ogcp/static/js/ogcp.js | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/ogcp/static/js/ogcp.js b/ogcp/static/js/ogcp.js index eaae467..8678759 100644 --- a/ogcp/static/js/ogcp.js +++ b/ogcp/static/js/ogcp.js @@ -242,48 +242,3 @@ function RemovePartition(evt) { }); } -async function digestMessage(msg) { - const msgUint8 = new TextEncoder().encode(msg); - const hashBuffer = await crypto.subtle.digest('SHA-512', msgUint8); - const hashArray = Array.from(new Uint8Array(hashBuffer)); - const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join(''); - return hashHex; -} - -function digestLoginPassword() { - const loginForm = $('#login-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); - - pwdInput.prop( "disabled", true ); - pwdHashInput.val(pwdStrHash); - $(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() - }); -} |