From 0bc38d1fc1007d26008b811be691cd8c27a7ae72 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Wed, 9 Oct 2024 13:46:31 +0200 Subject: [PATCH] website(fix): reject empty secrets Signed-off-by: Johan Haals --- website/src/createSecret/CreateSecret.tsx | 16 ++++++++++++++-- website/src/createSecret/Upload.tsx | 2 +- website/src/displaySecret/DisplaySecret.tsx | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/website/src/createSecret/CreateSecret.tsx b/website/src/createSecret/CreateSecret.tsx index 908df8882..7f1b5b9b5 100644 --- a/website/src/createSecret/CreateSecret.tsx +++ b/website/src/createSecret/CreateSecret.tsx @@ -51,6 +51,9 @@ const CreateSecret = () => { }; const onSubmit = async (form: any): Promise => { + if (!form.secret) { + return; + } // Use the manually entered password, or generate one const pw = form.password ? form.password : randomString(); setLoading(true); @@ -117,8 +120,10 @@ const CreateSecret = () => { rows="4" autoFocus={true} onKeyDown={onKeyDown} - placeholder={t('create.inputSecretPlaceholder')} - inputProps={{ spellCheck: 'false', 'data-gramm': 'false' }} + placeholder={t('create.inputSecretPlaceholder')} + slotProps={{ + htmlInput: { spellCheck: 'false', 'data-gramm': 'false' }, + }} /> )} /> @@ -199,6 +204,13 @@ export const SpecifyPasswordInput = (props: { control: Control }) => { spellCheck: 'false', 'data-gramm': 'false', }} + slotProps={{ + htmlInput: { + spellCheck: 'false', + 'data-gramm': 'false', + autoComplete: 'false', + }, + }} /> )} /> diff --git a/website/src/createSecret/Upload.tsx b/website/src/createSecret/Upload.tsx index 1f1807f13..6e878039b 100644 --- a/website/src/createSecret/Upload.tsx +++ b/website/src/createSecret/Upload.tsx @@ -101,7 +101,7 @@ const Upload = () => { } return ( - {isFileTooLarge && ('upload.fileTooLarge')} />} + {isFileTooLarge && } setError('')} />
diff --git a/website/src/displaySecret/DisplaySecret.tsx b/website/src/displaySecret/DisplaySecret.tsx index f68d9398e..2238dcd76 100644 --- a/website/src/displaySecret/DisplaySecret.tsx +++ b/website/src/displaySecret/DisplaySecret.tsx @@ -54,7 +54,7 @@ const EnterDecryptionKey = ({ autoFocus name="decryptionKey" id="decryptionKey" - placeholder={t('display.inputDecryptionKeyPlaceholder')} + placeholder={t('display.inputDecryptionKeyPlaceholder')} label={t('display.inputDecryptionKeyLabel')} value={tempPassword} error={invalidPassword}