mirror of
https://github.com/kmitresse/Cards-Rush.git
synced 2026-07-09 13:27:45 +00:00
fix(DevWeb): Re-organise folder structure and fix static files import
This commit is contained in:
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* LoginServlet.java, 20/03/2024
|
||||||
|
* UPPA M1 TI 2023-2024
|
||||||
|
* Pas de copyright, aucun droits
|
||||||
|
*/
|
||||||
|
|
||||||
|
package uppa.project.servlet;
|
||||||
|
|
||||||
|
import jakarta.servlet.ServletException;
|
||||||
|
import jakarta.servlet.annotation.WebServlet;
|
||||||
|
import jakarta.servlet.http.HttpServlet;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@WebServlet(name = "forgottenPasswordServlet", value = "/forgotten-password")
|
||||||
|
public class ForgottenPasswordServlet extends HttpServlet {
|
||||||
|
public void init() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
|
||||||
|
|
||||||
|
if (request.getSession().getAttribute("user") != null) {
|
||||||
|
response.sendRedirect(request.getContextPath() + "/main-menu");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
request.getRequestDispatcher("/WEB-INF/views/forgotten-password.jsp").forward(request, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void destroy() {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
package uppa.project.servlet;
|
package uppa.project.servlet;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import jakarta.servlet.ServletException;
|
import jakarta.servlet.ServletException;
|
||||||
import jakarta.servlet.annotation.WebServlet;
|
import jakarta.servlet.annotation.WebServlet;
|
||||||
import jakarta.servlet.http.HttpServlet;
|
import jakarta.servlet.http.HttpServlet;
|
||||||
@@ -17,15 +16,13 @@ import java.io.IOException;
|
|||||||
@WebServlet(name = "indexServlet", value = "/")
|
@WebServlet(name = "indexServlet", value = "/")
|
||||||
public class IndexServlet extends HttpServlet {
|
public class IndexServlet extends HttpServlet {
|
||||||
|
|
||||||
private final Gson gson = new Gson();
|
|
||||||
|
|
||||||
public void init() {
|
public void init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
|
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
|
||||||
|
|
||||||
if (request.getSession().getAttribute("user") != null) {
|
if (request.getSession().getAttribute("user") != null) {
|
||||||
response.sendRedirect(request.getContextPath() + "/dashboard");
|
response.sendRedirect(request.getContextPath() + "/main-menu");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,12 @@ public class LoginServlet extends HttpServlet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
|
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
|
||||||
request.getRequestDispatcher("/WEB-INF/login.jsp").forward(request, response);
|
if (request.getSession().getAttribute("user") != null) {
|
||||||
|
response.sendRedirect(request.getContextPath() + "/main-menu");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
request.getRequestDispatcher("/WEB-INF/views/login.jsp").forward(request, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
package uppa.project.servlet;
|
package uppa.project.servlet;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import jakarta.servlet.ServletException;
|
import jakarta.servlet.ServletException;
|
||||||
import jakarta.servlet.annotation.WebServlet;
|
import jakarta.servlet.annotation.WebServlet;
|
||||||
import jakarta.servlet.http.HttpServlet;
|
import jakarta.servlet.http.HttpServlet;
|
||||||
@@ -14,22 +13,20 @@ import jakarta.servlet.http.HttpServletRequest;
|
|||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
@WebServlet(name = "indexServlet", value = "/")
|
@WebServlet(name = "mainMenuServlet", value = "/main-menu")
|
||||||
public class MainMenuServlet extends HttpServlet {
|
public class MainMenuServlet extends HttpServlet {
|
||||||
|
|
||||||
private final Gson gson = new Gson();
|
|
||||||
|
|
||||||
public void init() {
|
public void init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
|
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
|
||||||
|
|
||||||
if (request.getSession().getAttribute("user") != null) {
|
if (request.getSession().getAttribute("user") == null) {
|
||||||
request.getRequestDispatcher("/WEB-INF/mainMenu.jsp").forward(request, response);
|
request.getRequestDispatcher("/WEB-INF/views/login.jsp").forward(request, response);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
response.sendRedirect(request.getContextPath() + "/login");
|
response.sendRedirect(request.getContextPath() + "/main-menu");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* LoginServlet.java, 20/03/2024
|
||||||
|
* UPPA M1 TI 2023-2024
|
||||||
|
* Pas de copyright, aucun droits
|
||||||
|
*/
|
||||||
|
|
||||||
|
package uppa.project.servlet;
|
||||||
|
|
||||||
|
import jakarta.servlet.ServletException;
|
||||||
|
import jakarta.servlet.annotation.WebServlet;
|
||||||
|
import jakarta.servlet.http.HttpServlet;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@WebServlet(name = "newGameServlet", value = "/new-game")
|
||||||
|
public class NewGameServlet extends HttpServlet {
|
||||||
|
public void init() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
|
||||||
|
|
||||||
|
if (request.getSession().getAttribute("user") == null) {
|
||||||
|
response.sendRedirect(request.getContextPath() + "/login");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
request.getRequestDispatcher("/WEB-INF/views/new-game.jsp").forward(request, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void destroy() {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* LoginServlet.java, 20/03/2024
|
||||||
|
* UPPA M1 TI 2023-2024
|
||||||
|
* Pas de copyright, aucun droits
|
||||||
|
*/
|
||||||
|
|
||||||
|
package uppa.project.servlet;
|
||||||
|
|
||||||
|
import jakarta.servlet.ServletException;
|
||||||
|
import jakarta.servlet.annotation.WebServlet;
|
||||||
|
import jakarta.servlet.http.HttpServlet;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@WebServlet(name = "registerServlet", value = "/register")
|
||||||
|
public class RegisterServlet extends HttpServlet {
|
||||||
|
|
||||||
|
public void init() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
|
||||||
|
if (request.getSession().getAttribute("user") != null) {
|
||||||
|
response.sendRedirect(request.getContextPath() + "/main-menu");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
request.getRequestDispatcher("/WEB-INF/views/register.jsp").forward(request, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||||
|
// TODO : Implement the registration process
|
||||||
|
}
|
||||||
|
|
||||||
|
public void destroy() {
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
@@ -6,6 +6,8 @@
|
|||||||
To change this template use File | Settings | File Templates.
|
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" %>
|
||||||
|
|
||||||
|
<style><%@include file="../static/css/navbar.css"%></style>
|
||||||
<nav>
|
<nav>
|
||||||
<p>
|
<p>
|
||||||
username: <!-- Récuperer le nom utilisateur --> <br/>
|
username: <!-- Récuperer le nom utilisateur --> <br/>
|
||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Title</title>
|
<title>Forgotten Password</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
+5
-8
@@ -3,8 +3,8 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Login</title>
|
<title>Login</title>
|
||||||
<script defer type="text/javascript" src="js/login.js"></script>
|
<script defer type="text/javascript"><%@include file="../static/js/login.js" %></script>
|
||||||
<link rel="stylesheet" href="css/login.css"/>
|
<style><%@include file="../static/css/login.css" %></style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
@@ -15,10 +15,7 @@
|
|||||||
<div class="flex-column login-gap">
|
<div class="flex-column login-gap">
|
||||||
<div>
|
<div>
|
||||||
<h1>Login</h1>
|
<h1>Login</h1>
|
||||||
<form id="login-form"
|
<form id="login-form" action="${pageContext.request.contextPath}/login" method="POST">
|
||||||
data-login-endpoint="${pageContext.request.contextPath}/login"
|
|
||||||
action="${pageContext.request.contextPath}/login"
|
|
||||||
method="POST">
|
|
||||||
|
|
||||||
<label id="username-label" for="username">Username:</label>
|
<label id="username-label" for="username">Username:</label>
|
||||||
<input type="text" id="username" name="username" required>
|
<input type="text" id="username" name="username" required>
|
||||||
@@ -31,9 +28,9 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<p><a href="forgottenPassword.jsp">Forgotten password?</a></p>
|
<p><a href="${pageContext.request.contextPath}/forgotten-password">Forgotten password?</a></p>
|
||||||
<hr>
|
<hr>
|
||||||
<p>Don't have an account? <a href="register.jsp">Register</a></p>
|
<p>Don't have an account? <a href="${pageContext.request.contextPath}/register">Register</a></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
+4
-4
@@ -3,13 +3,13 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Dashboard</title>
|
<title>Main Menu</title>
|
||||||
<link rel="stylesheet" href="css/dashboard.css"/>
|
|
||||||
<link rel="stylesheet" href="css/nav.css"/>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<main>
|
<main>
|
||||||
<jsp:include page="navBar.jsp"></jsp:include>
|
|
||||||
|
<jsp:include page="../components/navbar.jsp"/>
|
||||||
|
|
||||||
<section id="main">
|
<section id="main">
|
||||||
<h1 id="Title">Titre du jeu</h1>
|
<h1 id="Title">Titre du jeu</h1>
|
||||||
<div class="main-button">
|
<div class="main-button">
|
||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Title</title>
|
<title>New game</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<main>
|
<main>
|
||||||
+7
-7
@@ -3,7 +3,7 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Register</title>
|
<title>Register</title>
|
||||||
<link rel="stylesheet" href="css/login.css"/>
|
<style><%@include file="../static/css/login.css"%></style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
<div class="flex-column register-gap">
|
<div class="flex-column register-gap">
|
||||||
<div>
|
<div>
|
||||||
<h1>Register</h1>
|
<h1>Register</h1>
|
||||||
<form id="register-form" action="register" method="post">
|
<form id="register-form" action="${pageContext.request.contextPath}/register" method="post">
|
||||||
|
|
||||||
<label for="email">Email:</label>
|
<label for="email">Email:</label>
|
||||||
<input type="email" id="email" name="email" required>
|
<input type="email" id="email" name="email" required>
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
<label for="password">Password:</label>
|
<label for="password">Password:</label>
|
||||||
<input type="password" id="password" name="password" required>
|
<input type="password" id="password" name="password" required>
|
||||||
|
|
||||||
<label for="password">RePassword:</label>
|
<label for="repassword">RePassword:</label>
|
||||||
<input type="password" id="repassword" name="password" required>
|
<input type="password" id="repassword" name="password" required>
|
||||||
|
|
||||||
<label for="birthdate">Birthdate:</label>
|
<label for="birthdate">Birthdate:</label>
|
||||||
@@ -34,9 +34,9 @@
|
|||||||
<label for="gender">Gender:</label>
|
<label for="gender">Gender:</label>
|
||||||
<select name="gender" id="gender">
|
<select name="gender" id="gender">
|
||||||
<option value="">--Please choose an option--</option>
|
<option value="">--Please choose an option--</option>
|
||||||
<option value="male">Mâle</option>
|
<option value="MALE">Mâle</option>
|
||||||
<option value="female">Female</option>
|
<option value="FEMALE">Female</option>
|
||||||
<option value="non-binary">Non-binary</option>
|
<option value="OTHER">Other</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<input id="register-submit" type="submit" value="Register">
|
<input id="register-submit" type="submit" value="Register">
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<hr>
|
<hr>
|
||||||
<p>Already have an account? <a href="login.jsp">Login</a></p>
|
<p>Already have an account? <a href="${pageContext.request.contextPath}/login">Login</a></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
Reference in New Issue
Block a user