Docker
This commit is contained in:
@@ -46,22 +46,26 @@ router.post('/register', registerLimiter, async (req, res) => {
|
||||
}
|
||||
|
||||
if (!username || !password) {
|
||||
console.log('Registration failed: missing username or password');
|
||||
res.status(400).json({ error: 'Username и пароль обязательны' });
|
||||
return;
|
||||
}
|
||||
|
||||
if (!/^[a-zA-Z0-9_]{3,20}$/.test(username)) {
|
||||
console.log('Registration failed: invalid username format', username);
|
||||
res.status(400).json({ error: 'Username: 3-20 символов, только латиница, цифры, _' });
|
||||
return;
|
||||
}
|
||||
|
||||
if (password.length < config.minPasswordLength) {
|
||||
console.log('Registration failed: password too short');
|
||||
res.status(400).json({ error: `Пароль должен быть не менее ${config.minPasswordLength} символов` });
|
||||
return;
|
||||
}
|
||||
|
||||
// Password must contain at least one letter and one digit
|
||||
if (!/[a-zA-Zа-яА-Я]/.test(password) || !/\d/.test(password)) {
|
||||
console.log('Registration failed: password missing letters or digits');
|
||||
res.status(400).json({ error: 'Пароль должен содержать буквы и цифры' });
|
||||
return;
|
||||
}
|
||||
|
||||
15
apps/server/start.sh
Normal file
15
apps/server/start.sh
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Wait for DB
|
||||
echo "Waiting for database..."
|
||||
# Simple sleep for now, or use docker-compose healthcheck
|
||||
sleep 5
|
||||
|
||||
# Create DB schema (push for dev, or migrate deploy for prod)
|
||||
echo "Running Prisma DB push/seed..."
|
||||
npx prisma db push --accept-data-loss
|
||||
npx prisma db seed
|
||||
|
||||
# Start server
|
||||
echo "Starting server..."
|
||||
npm start
|
||||
BIN
apps/server/uploads/3d03f534-e466-460b-b48d-ff9e94049e9d.jpg
Normal file
BIN
apps/server/uploads/3d03f534-e466-460b-b48d-ff9e94049e9d.jpg
Normal file
Binary file not shown.
BIN
apps/server/uploads/777a5af2-4064-449d-a659-6b21e6bc48d0.webp
Normal file
BIN
apps/server/uploads/777a5af2-4064-449d-a659-6b21e6bc48d0.webp
Normal file
Binary file not shown.
BIN
apps/server/uploads/7ee26807-9bc0-44c9-b664-b17078a3efd3.avif
Normal file
BIN
apps/server/uploads/7ee26807-9bc0-44c9-b664-b17078a3efd3.avif
Normal file
Binary file not shown.
Reference in New Issue
Block a user