summaryrefslogtreecommitdiffstats
path: root/ogcp/static/js
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2022-06-28 12:31:59 +0200
committerJavier Sánchez Parra <jsanchez@soleta.eu>2022-06-30 09:26:18 +0200
commit61bd6bc4bac0cb930304b6fd7dfadd24e5318914 (patch)
tree88fdbbafba634d2052a36a4fe260b11864f378af /ogcp/static/js
parent06bcbe40a3caf76df062cbb883a0ac9e5fd2c723 (diff)
Move password hashing to the backend
This patch moves login password hashing from the frontend/javascript to the backend/flask. This patch moves password hashing of login and user management forms. Related commits: * c7b0024 ("Add password hashing") * 661254b ("Add 'Add user' to Users section")
Diffstat (limited to 'ogcp/static/js')
-rw-r--r--ogcp/static/js/ogcp.js45
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()
- });
-}