From edfdc05362f295a158cad0dc57fd5af338a86d73 Mon Sep 17 00:00:00 2001 From: Yarmo Mackenbach Date: Wed, 5 Oct 2022 11:38:39 +0200 Subject: [PATCH] Fix feedback --- static-src/ui.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/static-src/ui.js b/static-src/ui.js index e9c4246..6158063 100644 --- a/static-src/ui.js +++ b/static-src/ui.js @@ -395,7 +395,12 @@ const runArgon2VerificationUtility = () => { window.kx__fixArgon2Input = () => { const elInput = document.querySelector('#form-util-argon2-generate .input'); - elInput.value = `openpgp4fpr:${elInput.value.toLowerCase()}`; + elInput.value = elInput.value.toLowerCase(); + + if (!(/openpgp4fpr:[0-9a-zA-Z]+/.test(elInput.value))) { + elInput.value = `openpgp4fpr:${elInput.value}`; + } + elInput.dispatchEvent(new Event("input")); } @@ -455,6 +460,11 @@ const runBcryptVerificationUtility = () => { window.kx__fixBcryptInput = () => { const elInput = document.querySelector('#form-util-bcrypt-generate .input'); - elInput.value = `openpgp4fpr:${elInput.value.toLowerCase()}`; + elInput.value = elInput.value.toLowerCase(); + + if (!(/openpgp4fpr:[0-9a-zA-Z]+/.test(elInput.value))) { + elInput.value = `openpgp4fpr:${elInput.value}`; + } + elInput.dispatchEvent(new Event("input")); }