Ask for pin for private rooms

This commit is contained in:
Leonardo Segala 2025-08-02 13:34:10 +02:00
parent 9ec601b263
commit fb49da2edd
2 changed files with 45 additions and 16 deletions

View file

@ -73,7 +73,7 @@ def on_leave(data):
@app.get("/api/join")
def join():
room_id = request.args.get("room")
code = request.args.get("code")
code = request.args.get("pin")
if room_id is None:
return error("Missing room id")
@ -81,8 +81,11 @@ def join():
if (room := state.rooms.get(int(room_id))) is None:
return error("Invalid room")
if room.pin is not None and room.pin != code:
return error("Invalid code")
if room.pin is not None:
if code is None:
return error("Missing code")
if int(room.pin) != int(code):
return error("Invalid code")
distance = distance_between_coords(
lhs=room.coord,