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