feat: dev-web - update navbar

This commit is contained in:
kmitresse
2024-04-05 15:16:52 +02:00
parent 61603ddac6
commit a8040fccec
11 changed files with 31 additions and 14 deletions
@@ -36,6 +36,7 @@ public class ForgottenPasswordServlet extends HttpServlet {
}
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
request.setAttribute("current", "forgotten-password");
request.getRequestDispatcher("/WEB-INF/views/forgotten-password.jsp").forward(request, response);
}
@@ -25,7 +25,7 @@ public class LoginServlet extends HttpServlet {
response.sendRedirect(request.getContextPath() + "/main-menu");
return;
}
request.setAttribute("current", "login");
request.getRequestDispatcher("/WEB-INF/views/login.jsp").forward(request, response);
}
@@ -32,6 +32,7 @@ public class MainMenuServlet extends HttpServlet {
// response.sendRedirect(request.getContextPath() + "/login");
// return;
// }
request.setAttribute("current", "main-menu");
manageNewGame(request, response, user);
//manageStatistiques(request, response, user);
request.getRequestDispatcher("/WEB-INF/views/main-menu.jsp").forward(request, response);
@@ -35,6 +35,7 @@ public class RegisterServlet extends HttpServlet {
return;
}
request.setAttribute("current", "register");
request.getRequestDispatcher("/WEB-INF/views/register.jsp").forward(request, response);
}
@@ -27,6 +27,7 @@ public class ResetPasswordServlet extends HttpServlet {
response.sendRedirect(request.getContextPath() + "/forgotten-password?error=expired-token");
return;
}
request.setAttribute("current", "reset-password");
request.getRequestDispatcher("/WEB-INF/views/reset-password.jsp").forward(request, response);
}
@@ -1,3 +1,5 @@
<%@ page import="uppa.project.pojo.User" %>
<%@ page pageEncoding="UTF-8" %>
<%--
Created by IntelliJ IDEA.
User: kmitr
@@ -5,13 +7,22 @@
Time: 11:42
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%--<%@ page contentType="text/html;charset=UTF-8" language="java" %>--%>
<% String currentPage =(String) request.getAttribute("current"); %>
<style><%@include file="/static/css/navbar.css"%></style>
<nav>
<a href="index"><img src="${pageContext.request.contextPath}/static/img/CardsRushLogo.png" alt="Logo CardsRush"> </a>
<p>
username: <!-- Récuperer le nom utilisateur --> <br/>
best score: <!-- Récuperer le meilleur score -->
</p>
<a href="${pageContext.request.contextPath}/index"><img src="${pageContext.request.contextPath}/static/img/CardsRushLogo.png" alt="Logo CardsRush"> </a>
<% if (currentPage == "register" || currentPage == "forgotten-password" || currentPage == "reset-password"){ %>
<button><a href="${pageContext.request.contextPath}/login">Se connecter</a></button>
<% }
if (currentPage == "login" || currentPage == "forgotten-password" || currentPage == "reset-password") { %>
<button> <a href="${pageContext.request.contextPath}/register">S'inscrire</a></button>
<% } else if (currentPage == "main-menu"){ %>
<% User user = (User) request.getAttribute("user"); %>
<p>
pseudo: <%= user != null ? user.getUsername() : "anonyme"%> <br/>
nombre de victoires: <%= user != null ? user.getNbWin() : "0" %>
</p>
<button><a href="${pageContext.request.contextPath}/logout">Se déconnecter</a></button>
<% } %>
</nav>
@@ -14,6 +14,7 @@
<script src="${pageContext.request.contextPath}/static/js/forgotten-password.js" defer></script>
</head>
<body>
<%@include file="../components/navbar.jsp"%>
<main>
<h1>Mot de passe oublié</h1>
<p>Entrer votre email pour recevoir un lien de récupération</p>
@@ -8,7 +8,7 @@
<meta charset="utf-8">
</head>
<body>
<%@include file="../components/navbar.jsp"%>
<main>
<section id="title">Cards Rush</section>
<section id="form">
@@ -8,11 +8,11 @@
<%-- <link href="${pageContext.request.contextPath}/static/css/main-menu.css" rel="stylesheet">--%>
<script src="${pageContext.request.contextPath}/static/js/modal.js" defer></script>
<script src="${pageContext.request.contextPath}/static/js/new-game.js" defer></script>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<%@include file="../components/navbar.jsp"%>
<main>
<jsp:include page="../components/navbar.jsp"/>
<section id="main">
<h1 id="Title">Titre du jeu</h1>
<div class="main-button">
@@ -20,8 +20,8 @@
<button class="modal-toggle" data-target="#statisticsModal" >Statistiques</button>
</div>
</section>
<%@include file="../components/new-game.jsp"%>
<%@include file="../components/statistics.jsp"%>
</main>
<%@include file="../components/new-game.jsp"%>
<%@include file="../components/statistics.jsp"%>
</body>
</html>
@@ -7,7 +7,7 @@
<script src="${pageContext.request.contextPath}/static/js/register.js" defer></script>
</head>
<body>
<%@include file="../components/navbar.jsp"%>
<main>
<section id="title">Inscription</section>
<section id="form">
@@ -11,6 +11,7 @@
<script src="${pageContext.request.contextPath}/static/js/reset-password.js" defer></script>
</head>
<body>
<%@include file="../components/navbar.jsp"%>
<main>
<jsp:include page="../components/navbar.jsp"/>
<h1>Récupération du mot de passe</h1>