password type checking

This commit is contained in:
Charmunks 2025-11-09 23:02:07 -05:00
parent 2bfd8c6325
commit 5eb15c5191
3 changed files with 5 additions and 3 deletions

View file

@ -1,4 +1,4 @@
export const API_BASE = 'https://t0080w08wcockgs44ws8w880.b.selfhosted.hackclub.com/api/v1';
export const API_BASE = 'http://localhost:2593/api/v1';
export const ERROR_MESSAGES = {
NETWORK_ERROR: 'Network error. Please try again.',

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 {