Skip to content

Commit

Permalink
Merge pull request #2494 from jhaals/fix-empty-secret
Browse files Browse the repository at this point in the history
website(fix): reject empty secrets
  • Loading branch information
jhaals authored Oct 9, 2024
2 parents 8bfe07b + 0bc38d1 commit 7dd6c64
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
16 changes: 14 additions & 2 deletions website/src/createSecret/CreateSecret.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ const CreateSecret = () => {
};

const onSubmit = async (form: any): Promise<void> => {
if (!form.secret) {
return;
}
// Use the manually entered password, or generate one
const pw = form.password ? form.password : randomString();
setLoading(true);
Expand Down Expand Up @@ -117,8 +120,10 @@ const CreateSecret = () => {
rows="4"
autoFocus={true}
onKeyDown={onKeyDown}
placeholder={t<string>('create.inputSecretPlaceholder')}
inputProps={{ spellCheck: 'false', 'data-gramm': 'false' }}
placeholder={t('create.inputSecretPlaceholder')}
slotProps={{
htmlInput: { spellCheck: 'false', 'data-gramm': 'false' },
}}
/>
)}
/>
Expand Down Expand Up @@ -199,6 +204,13 @@ export const SpecifyPasswordInput = (props: { control: Control<any> }) => {
spellCheck: 'false',
'data-gramm': 'false',
}}
slotProps={{
htmlInput: {
spellCheck: 'false',
'data-gramm': 'false',
autoComplete: 'false',
},
}}
/>
)}
/>
Expand Down
2 changes: 1 addition & 1 deletion website/src/createSecret/Upload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const Upload = () => {
}
return (
<Grid>
{isFileTooLarge && <Error message={t<string>('upload.fileTooLarge')} />}
{isFileTooLarge && <Error message={t('upload.fileTooLarge')} />}
<Error message={error} onClick={() => setError('')} />
<form onSubmit={handleSubmit(onSubmit)}>
<div {...getRootProps()}>
Expand Down
2 changes: 1 addition & 1 deletion website/src/displaySecret/DisplaySecret.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const EnterDecryptionKey = ({
autoFocus
name="decryptionKey"
id="decryptionKey"
placeholder={t<string>('display.inputDecryptionKeyPlaceholder')}
placeholder={t('display.inputDecryptionKeyPlaceholder')}
label={t('display.inputDecryptionKeyLabel')}
value={tempPassword}
error={invalidPassword}
Expand Down

0 comments on commit 7dd6c64

Please sign in to comment.