mirror of
https://github.com/kmitresse/Cards-Rush.git
synced 2026-05-14 01:21:49 +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;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.annotation.WebServlet;
|
||||
import jakarta.servlet.http.HttpServlet;
|
||||
@@ -17,15 +16,13 @@ import java.io.IOException;
|
||||
@WebServlet(name = "indexServlet", value = "/")
|
||||
public class IndexServlet extends HttpServlet {
|
||||
|
||||
private final Gson gson = new Gson();
|
||||
|
||||
public void init() {
|
||||
}
|
||||
|
||||
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
|
||||
|
||||
if (request.getSession().getAttribute("user") != null) {
|
||||
response.sendRedirect(request.getContextPath() + "/dashboard");
|
||||
response.sendRedirect(request.getContextPath() + "/main-menu");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,12 @@ public class LoginServlet extends HttpServlet {
|
||||
}
|
||||
|
||||
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 {
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
package uppa.project.servlet;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.annotation.WebServlet;
|
||||
import jakarta.servlet.http.HttpServlet;
|
||||
@@ -14,22 +13,20 @@ import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
@WebServlet(name = "indexServlet", value = "/")
|
||||
@WebServlet(name = "mainMenuServlet", value = "/main-menu")
|
||||
public class MainMenuServlet extends HttpServlet {
|
||||
|
||||
private final Gson gson = new Gson();
|
||||
|
||||
public void init() {
|
||||
}
|
||||
|
||||
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
|
||||
|
||||
if (request.getSession().getAttribute("user") != null) {
|
||||
request.getRequestDispatcher("/WEB-INF/mainMenu.jsp").forward(request, response);
|
||||
if (request.getSession().getAttribute("user") == null) {
|
||||
request.getRequestDispatcher("/WEB-INF/views/login.jsp").forward(request, response);
|
||||
return;
|
||||
}
|
||||
|
||||
response.sendRedirect(request.getContextPath() + "/login");
|
||||
response.sendRedirect(request.getContextPath() + "/main-menu");
|
||||
}
|
||||
|
||||
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.
|
||||
--%>
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
|
||||
<style><%@include file="../static/css/navbar.css"%></style>
|
||||
<nav>
|
||||
<p>
|
||||
username: <!-- Récuperer le nom utilisateur --> <br/>
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<html>
|
||||
<head>
|
||||
<title>Title</title>
|
||||
<title>Forgotten Password</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
+5
-8
@@ -3,8 +3,8 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Login</title>
|
||||
<script defer type="text/javascript" src="js/login.js"></script>
|
||||
<link rel="stylesheet" href="css/login.css"/>
|
||||
<script defer type="text/javascript"><%@include file="../static/js/login.js" %></script>
|
||||
<style><%@include file="../static/css/login.css" %></style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -15,10 +15,7 @@
|
||||
<div class="flex-column login-gap">
|
||||
<div>
|
||||
<h1>Login</h1>
|
||||
<form id="login-form"
|
||||
data-login-endpoint="${pageContext.request.contextPath}/login"
|
||||
action="${pageContext.request.contextPath}/login"
|
||||
method="POST">
|
||||
<form id="login-form" action="${pageContext.request.contextPath}/login" method="POST">
|
||||
|
||||
<label id="username-label" for="username">Username:</label>
|
||||
<input type="text" id="username" name="username" required>
|
||||
@@ -31,9 +28,9 @@
|
||||
</form>
|
||||
</div>
|
||||
<div>
|
||||
<p><a href="forgottenPassword.jsp">Forgotten password?</a></p>
|
||||
<p><a href="${pageContext.request.contextPath}/forgotten-password">Forgotten password?</a></p>
|
||||
<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>
|
||||
</section>
|
||||
+4
-4
@@ -3,13 +3,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Dashboard</title>
|
||||
<link rel="stylesheet" href="css/dashboard.css"/>
|
||||
<link rel="stylesheet" href="css/nav.css"/>
|
||||
<title>Main Menu</title>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<jsp:include page="navBar.jsp"></jsp:include>
|
||||
|
||||
<jsp:include page="../components/navbar.jsp"/>
|
||||
|
||||
<section id="main">
|
||||
<h1 id="Title">Titre du jeu</h1>
|
||||
<div class="main-button">
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<html>
|
||||
<head>
|
||||
<title>Title</title>
|
||||
<title>New game</title>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
+7
-7
@@ -3,7 +3,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Register</title>
|
||||
<link rel="stylesheet" href="css/login.css"/>
|
||||
<style><%@include file="../static/css/login.css"%></style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<div class="flex-column register-gap">
|
||||
<div>
|
||||
<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>
|
||||
<input type="email" id="email" name="email" required>
|
||||
@@ -25,7 +25,7 @@
|
||||
<label for="password">Password:</label>
|
||||
<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>
|
||||
|
||||
<label for="birthdate">Birthdate:</label>
|
||||
@@ -34,9 +34,9 @@
|
||||
<label for="gender">Gender:</label>
|
||||
<select name="gender" id="gender">
|
||||
<option value="">--Please choose an option--</option>
|
||||
<option value="male">Mâle</option>
|
||||
<option value="female">Female</option>
|
||||
<option value="non-binary">Non-binary</option>
|
||||
<option value="MALE">Mâle</option>
|
||||
<option value="FEMALE">Female</option>
|
||||
<option value="OTHER">Other</option>
|
||||
</select>
|
||||
|
||||
<input id="register-submit" type="submit" value="Register">
|
||||
@@ -44,7 +44,7 @@
|
||||
</div>
|
||||
<div>
|
||||
<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>
|
||||
</section>
|
||||
Reference in New Issue
Block a user