Merge pull request #5 from hackclub/dev

password type checking
This commit is contained in:
Charmunk 2025-11-09 23:03:41 -05:00 committed by GitHub
commit a148612654
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View file

@ -301,7 +301,7 @@
{#if newSpaceType !== 'kicad' && newSpaceType !== 'blender'}
<div class="form-group">
<label class="form-label" for="password">Password</label>
<label class="form-label" for="password">Password (min. 8 characters)</label>
<p class="password-info">This password will be needed to access the space. Please pick a secure password, you cannot change it later.</p>
<div class="password-input-wrapper">
{#if showPassword}
@ -353,7 +353,7 @@
<button
class="btn-primary"
on:click={createSpace}
disabled={loading || (newSpaceType !== 'kicad' && newSpaceType !== 'blender' && !newSpacePassword)}
disabled={loading || (newSpaceType !== 'kicad' && newSpaceType !== 'blender' && (!newSpacePassword || newSpacePassword.length < 8))}
>
{loading ? 'Creating...' : 'Create Space'}
</button>

View file

@ -64,6 +64,8 @@ export const createContainer = async (password, type, authorization) => {
password = crypto.randomBytes(16).toString('hex');
} else if (!password) {
throw new Error("Missing container password");
} else if (password.length < 8) {
throw new Error("Password must be at least 8 characters long");
}
try {