Added serverside check
This commit is contained in:
parent
1fefb44b51
commit
cacea24aa6
1 changed files with 5 additions and 1 deletions
|
@ -31,7 +31,11 @@ app.get("/", (_, res) => {
|
||||||
})
|
})
|
||||||
|
|
||||||
app.post("/", (req, res) => {
|
app.post("/", (req, res) => {
|
||||||
if (!req.body.room.trim() || rooms[req.body.room]) {
|
if (
|
||||||
|
!req.body.room.trim() ||
|
||||||
|
!/^[-a-z0-9]+$/i.test(req.body.room) ||
|
||||||
|
rooms[req.body.room]
|
||||||
|
) {
|
||||||
return res.redirect("/")
|
return res.redirect("/")
|
||||||
}
|
}
|
||||||
rooms[req.body.room] = { users: {} }
|
rooms[req.body.room] = { users: {} }
|
||||||
|
|
Reference in a new issue