Fix bug password and tournament
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
# By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2024/09/25 23:28:49 by edbernar #+# #+# #
|
||||
# Updated: 2024/09/27 16:00:05 by tomoron ### ########.fr #
|
||||
# Updated: 2024/11/22 23:00:54 by edbernar ### ########.fr #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
@ -17,7 +17,7 @@ import hashlib
|
||||
import json
|
||||
|
||||
def changePassword(socket, user, old, new):
|
||||
if(user.id42 == None):
|
||||
if(user.id42 != None):
|
||||
socket.sendError("You can't set or change this field if you have a 42 account", 9031)
|
||||
return(False)
|
||||
if (old == None):
|
||||
|
@ -3,10 +3,10 @@
|
||||
# ::: :::::::: #
|
||||
# start.py :+: :+: :+: #
|
||||
# +:+ +:+ +:+ #
|
||||
# By: tomoron <tomoron@student.42.fr> +#+ +:+ +#+ #
|
||||
# By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2024/10/04 17:16:02 by tomoron #+# #+# #
|
||||
# Updated: 2024/10/14 20:25:16 by tomoron ### ########.fr #
|
||||
# Updated: 2024/11/22 23:18:15 by edbernar ### ########.fr #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
@ -14,22 +14,25 @@ from ...Tournament import Tournament
|
||||
from ...GameSettings import GameSettings
|
||||
|
||||
async def tournamentStart(socket, content):
|
||||
skinId = content.get("skinId", 0)
|
||||
if(skinId < 0 or skinId >= GameSettings.nbSkins):
|
||||
socket.sendError("Skin id out of range", 9033)
|
||||
return;
|
||||
goalId = content.get("goalId",0)
|
||||
if(goalId < 0 or goalId >= GameSettings.nbGoals):
|
||||
socket.sendError("Goal id out of range", 9039)
|
||||
return;
|
||||
if("code" in content and len(content["code"])):
|
||||
if(content["code"] in Tournament.currentTournaments):
|
||||
Tournament.currentTournaments[content["code"]].join(socket, skin, goal)
|
||||
else:
|
||||
socket.sync_send("tournament",{"action":0, "exist":False})
|
||||
else:
|
||||
nbBot = content.get("nbBot", 0)
|
||||
if(nbBot < 0 or nbBot > 7):
|
||||
socket.sendError("invalid number of bots", 9040)
|
||||
try:
|
||||
skinId = content.get("skinId", 0)
|
||||
if(skinId < 0 or skinId >= GameSettings.nbSkins):
|
||||
socket.sendError("Skin id out of range", 9033)
|
||||
return;
|
||||
Tournament(socket, nbBot, skinId, goalId)
|
||||
goalId = content.get("goalId",0)
|
||||
if(goalId < 0 or goalId >= GameSettings.nbGoals):
|
||||
socket.sendError("Goal id out of range", 9039)
|
||||
return;
|
||||
if("code" in content and len(content["code"])):
|
||||
if(content["code"] in Tournament.currentTournaments):
|
||||
Tournament.currentTournaments[content["code"]].join(socket, skinId, goalId)
|
||||
else:
|
||||
socket.sync_send("tournament",{"action":0, "exist":False})
|
||||
else:
|
||||
nbBot = content.get("nbBot", 0)
|
||||
if(nbBot < 0 or nbBot > 7):
|
||||
socket.sendError("invalid number of bots", 9040)
|
||||
return;
|
||||
Tournament(socket, nbBot, skinId, goalId)
|
||||
except Exception as e:
|
||||
socket.sendError("error tournament", 9140, e)
|
||||
|
@ -6,7 +6,7 @@
|
||||
# By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2024/09/09 14:31:30 by tomoron #+# #+# #
|
||||
# Updated: 2024/11/19 16:52:23 by tomoron ### ########.fr #
|
||||
# Updated: 2024/11/22 22:23:43 by edbernar ### ########.fr #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
@ -53,7 +53,7 @@ functionRequest = [login, getPrivateListUser, getPrivateListMessage,
|
||||
from random import randint
|
||||
|
||||
class WebsocketHandler(AsyncWebsocketConsumer):
|
||||
debugMode = False
|
||||
debugMode = True
|
||||
|
||||
# format : {id : socket, ...}
|
||||
onlinePlayers = {}
|
||||
|
Reference in New Issue
Block a user