Fix bug password and tournament

This commit is contained in:
Kum1ta
2024-11-22 23:22:14 +01:00
parent 943afda2f7
commit 395bbd8a5f
5 changed files with 36 additions and 33 deletions

View File

@ -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):

View File

@ -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,6 +14,7 @@ from ...Tournament import Tournament
from ...GameSettings import GameSettings
async def tournamentStart(socket, content):
try:
skinId = content.get("skinId", 0)
if(skinId < 0 or skinId >= GameSettings.nbSkins):
socket.sendError("Skin id out of range", 9033)
@ -24,7 +25,7 @@ async def tournamentStart(socket, content):
return;
if("code" in content and len(content["code"])):
if(content["code"] in Tournament.currentTournaments):
Tournament.currentTournaments[content["code"]].join(socket, skin, goal)
Tournament.currentTournaments[content["code"]].join(socket, skinId, goalId)
else:
socket.sync_send("tournament",{"action":0, "exist":False})
else:
@ -33,3 +34,5 @@ async def tournamentStart(socket, content):
socket.sendError("invalid number of bots", 9040)
return;
Tournament(socket, nbBot, skinId, goalId)
except Exception as e:
socket.sendError("error tournament", 9140, e)

View File

@ -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 = {}