From 4d9f87e4c48e682d00e31c83bd5f86515601efcd Mon Sep 17 00:00:00 2001 From: melohagan <101575380+melohagan@users.noreply.github.com> Date: Fri, 30 Aug 2024 10:16:16 +0100 Subject: [PATCH] Set password to 12 characters (#14478) --- .../users/_components/ForceResetPasswordModal.svelte | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/builder/src/pages/builder/portal/users/users/_components/ForceResetPasswordModal.svelte b/packages/builder/src/pages/builder/portal/users/users/_components/ForceResetPasswordModal.svelte index 8a7a3940bfa..36fdcccbcee 100644 --- a/packages/builder/src/pages/builder/portal/users/users/_components/ForceResetPasswordModal.svelte +++ b/packages/builder/src/pages/builder/portal/users/users/_components/ForceResetPasswordModal.svelte @@ -7,7 +7,15 @@ export let user - const password = Math.random().toString(36).slice(2, 20) + const generatePassword = length => { + const array = new Uint8Array(length) + crypto.getRandomValues(array) + return Array.from(array, byte => byte.toString(36).padStart(2, "0")) + .join("") + .slice(0, length) + } + + const password = generatePassword(12) async function resetPassword() { try {