feat(room): enforce minimum room name length of 2 characters in creation and editing
All checks were successful
Build & Push Docker Image / build (push) Successful in 6m17s
All checks were successful
Build & Push Docker Image / build (push) Successful in 6m17s
This commit is contained in:
@@ -74,7 +74,7 @@ export async function createMeeting(room, logoutURL, loginURL = null, presentati
|
|||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
meetingID: room.uid,
|
meetingID: room.uid,
|
||||||
name: room.name,
|
name: room.name.length >= 2 ? room.name : room.name.padEnd(2, ' '),
|
||||||
attendeePW,
|
attendeePW,
|
||||||
moderatorPW,
|
moderatorPW,
|
||||||
welcome,
|
welcome,
|
||||||
|
|||||||
@@ -166,6 +166,9 @@ router.post('/', authenticateToken, async (req, res) => {
|
|||||||
if (!name || name.trim().length === 0) {
|
if (!name || name.trim().length === 0) {
|
||||||
return res.status(400).json({ error: 'Room name is required' });
|
return res.status(400).json({ error: 'Room name is required' });
|
||||||
}
|
}
|
||||||
|
if (name.trim().length < 2) {
|
||||||
|
return res.status(400).json({ error: 'Room name must be at least 2 characters' });
|
||||||
|
}
|
||||||
|
|
||||||
// M7: field length limits
|
// M7: field length limits
|
||||||
if (name.trim().length > 100) {
|
if (name.trim().length > 100) {
|
||||||
@@ -243,6 +246,9 @@ router.put('/:uid', authenticateToken, async (req, res) => {
|
|||||||
} = req.body;
|
} = req.body;
|
||||||
|
|
||||||
// M12: field length limits (same as create)
|
// M12: field length limits (same as create)
|
||||||
|
if (name && name.trim().length < 2) {
|
||||||
|
return res.status(400).json({ error: 'Room name must be at least 2 characters' });
|
||||||
|
}
|
||||||
if (name && name.trim().length > 100) {
|
if (name && name.trim().length > 100) {
|
||||||
return res.status(400).json({ error: 'Room name must not exceed 100 characters' });
|
return res.status(400).json({ error: 'Room name must not exceed 100 characters' });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -205,6 +205,7 @@ export default function Dashboard() {
|
|||||||
className="input-field"
|
className="input-field"
|
||||||
placeholder={t('dashboard.roomNamePlaceholder')}
|
placeholder={t('dashboard.roomNamePlaceholder')}
|
||||||
required
|
required
|
||||||
|
minLength={2}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -502,6 +502,7 @@ export default function RoomDetail() {
|
|||||||
onChange={e => setEditRoom({ ...editRoom, name: e.target.value })}
|
onChange={e => setEditRoom({ ...editRoom, name: e.target.value })}
|
||||||
className="input-field"
|
className="input-field"
|
||||||
required
|
required
|
||||||
|
minLength={2}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user