Site
- add new page "profil" - new response server user_info Django - add new request type "get_user_info" - edit function for /game /profil /wait_game
This commit is contained in:
@ -17,7 +17,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id="loginPopup" class="popup">
|
||||
<div class="container">
|
||||
<div class="containerHomePage">
|
||||
<div class="left-side"></div>
|
||||
<div class="right-side">
|
||||
<h1>Access to a new WORLD</h1>
|
||||
|
@ -6,11 +6,13 @@
|
||||
<title>Chat</title>
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1'>
|
||||
<link rel='stylesheet' type='text/css' href='/static/style/homePage/home.css'>
|
||||
<link rel='stylesheet' type='text/css' href='/static/style/global/global.css'>
|
||||
<link rel='stylesheet' type='text/css' href='/static/style/homePage/liveChat.css'>
|
||||
<link rel='stylesheet' type='text/css' href='/static/style/homePage/loginPage.css'>
|
||||
<link rel='stylesheet' type='text/css' href='/static/style/global/notification.css'>
|
||||
<link rel='stylesheet' type='text/css' href='/static/style/lobbyPage/lobbyPage.css'>
|
||||
<link rel='stylesheet' type='text/css' href='/static/style/game/games.css'>
|
||||
<link rel='stylesheet' type='text/css' href='/static/style/profilPage/profil.css'>
|
||||
<script type="module" src='/static/javascript/main.js'></script>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
|
@ -0,0 +1,23 @@
|
||||
<div id="profil">
|
||||
<div class="container">
|
||||
<!-- Profile Section -->
|
||||
<div class="background-card"></div>
|
||||
<div class="profile-section">
|
||||
<div class="profile-image"></div>
|
||||
<div class="profile-info">
|
||||
<h2>Username <span class="online-status"></span></h2>
|
||||
<p>150 Elo</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Dashboard and History Section -->
|
||||
<div class="content">
|
||||
<div class="dashboard">
|
||||
<h3>Dashboard</h3>
|
||||
</div>
|
||||
<div class="history">
|
||||
<h3>History</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,24 @@
|
||||
# **************************************************************************** #
|
||||
# #
|
||||
# ::: :::::::: #
|
||||
# getUserInfo.py :+: :+: :+: #
|
||||
# +:+ +:+ +:+ #
|
||||
# By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2024/09/20 00:16:57 by edbernar #+# #+# #
|
||||
# Updated: 2024/09/20 01:08:45 by edbernar ### ########.fr #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
from asgiref.sync import sync_to_async
|
||||
from ..models import User
|
||||
import json
|
||||
|
||||
@sync_to_async
|
||||
def getUserInfo(socket, content):
|
||||
user = User.objects.filter(id=content['id']).values().first()
|
||||
if (not user):
|
||||
socket.sync_send({"type":"user_info", "content": None})
|
||||
return
|
||||
socket.sync_send({"type":"user_info", "content":{'username': user['username'], 'pfp': user['pfp'], 'banner': user['banner']}})
|
||||
|
@ -24,7 +24,9 @@ urlpatterns = [
|
||||
path("multiLocalGamePage", views.multiLocalGamePage, name='multiLocalGamePage'),
|
||||
path("multiOnlineGamePage", views.multiOnlineGamePage, name='multiOnlineGamePage'),
|
||||
path("waitingGamePage", views.waitingGamePage, name='waitingGamePage'),
|
||||
path("profilPage", views.profilPage, name='profilPage'),
|
||||
path("game", views.game, name='game'),
|
||||
path("profil", views.profil, name='profil'),
|
||||
path("wait_game", views.game, name='wait_game'),
|
||||
path("login42", views.login42, name='login42'),
|
||||
path("logout", views.logout, name='logout'),
|
||||
|
@ -52,14 +52,23 @@ def waitingGamePage(request):
|
||||
return render(request, "waitingGamePage.html", {})
|
||||
|
||||
def game(request):
|
||||
if(not request.session.get("logged_in", False)):
|
||||
return(HttpResponse("you are not logged in",status=403))
|
||||
return redirect("/lobby")
|
||||
# return lobbyPage(request)
|
||||
return redirect('/lobby')
|
||||
|
||||
def wait_game(request):
|
||||
# return lobbyPage(request)
|
||||
return redirect('/lobby')
|
||||
|
||||
def profil(request):
|
||||
# return lobbyPage(request)
|
||||
return redirect('/lobby')
|
||||
|
||||
def profilPage(request):
|
||||
if(request.method != "POST"):
|
||||
return index(request)
|
||||
if(not request.session.get("logged_in", False)):
|
||||
return(HttpResponse("you are not logged in",status=403))
|
||||
return redirect("/lobby")
|
||||
return render(request, "profilPage.html", {})
|
||||
|
||||
def verify(request):
|
||||
req_token = request.GET.get('token', None)
|
||||
|
@ -6,7 +6,7 @@
|
||||
# By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2024/09/09 14:31:30 by tomoron #+# #+# #
|
||||
# Updated: 2024/09/18 07:33:08 by edbernar ### ########.fr #
|
||||
# Updated: 2024/09/20 00:16:31 by edbernar ### ########.fr #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
@ -27,14 +27,15 @@ from .typeRequests.createAccount import createAccount
|
||||
from .typeRequests.login import login
|
||||
from .typeRequests.getAllListUser import getAllListUser
|
||||
from .typeRequests.gameRequest import gameRequest
|
||||
from .typeRequests.getUserInfo import getUserInfo
|
||||
|
||||
typeRequest = ["login", "get_private_list_user", "get_private_list_message",
|
||||
"send_private_message", "create_account", "get_all_list_user", "game",
|
||||
"search_user"
|
||||
"search_user", "get_user_info"
|
||||
]
|
||||
functionRequest = [login, getPrivateListUser, getPrivateListMessage,
|
||||
sendPrivateMessage, createAccount, getAllListUser, gameRequest,
|
||||
searchUser
|
||||
searchUser, getUserInfo
|
||||
]
|
||||
|
||||
from random import randint
|
||||
|
Reference in New Issue
Block a user