diff --git a/src/main/java/servlet/AdminServlet.java b/src/main/java/servlet/AdminServlet.java
index e88cdf9c30bc165352bb41a78c8ae01a18fccd9e..be98894a9bd7e6d7e23f0595acdb4e1376b9c3d3 100644
--- a/src/main/java/servlet/AdminServlet.java
+++ b/src/main/java/servlet/AdminServlet.java
@@ -1,5 +1,7 @@
package servlet;
+import beans.Comment;
+import beans.Post;
import beans.Web_user;
import dao.CommentDao;
import dao.DaoFactory;
@@ -23,22 +25,82 @@ public class AdminServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
-
+
PostDao postDao = DaoFactory.getPostDao();
Web_userDao userDao = DaoFactory.getWeb_userDao();
CommentDao commentDao = DaoFactory.getCommentDao();
-
+
// Envoie les trois listes à la view
req.setAttribute("post", postDao.list());
req.setAttribute("users", userDao.list());
- req.setAttribute("reportedComments", commentDao.list());
-
+ req.setAttribute("reportedComments", commentDao.listReported());
+
this.getServletContext().getRequestDispatcher(VIEW).forward(req, resp);
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
-
+
+ // Utilisation du mini formulaire admin, les boutons envoient une action et une id
+ String action = req.getParameter("action");
+ String idText = req.getParameter("id");
+
+ if (action == null || idText == null) {
+ resp.sendRedirect(req.getContextPath() + "/admin");
+ return;
+ }
+
+ long id = 0;
+ try {
+ id = Long.parseLong(idText); // Exception si ce n'est pas un nombre (int / long)
+
+ } catch (NumberFormatException ex) {
+ resp.sendRedirect(req.getContextPath() + "/admin");
+ return;
+ }
+
+ PostDao postDao = DaoFactory.getPostDao();
+ Web_userDao userDao = DaoFactory.getWeb_userDao();
+ CommentDao commentDao = DaoFactory.getCommentDao();
+
+ if (action.equals("deletePost")) {
+ Post post = postDao.find(id);
+ if (post != null) {
+ postDao.delete(post);
+ }
+ } else if (action.equals("validateComment")) {
+ // Si le commentaire est valide, on ne peut plus le signaler
+ commentDao.validate((int) id); // cast un int pour la conversion long --> int
+
+ } else if (action.equals("deleteComment")) {
+ Comment comment = commentDao.find(id);
+ if (comment != null) {
+ commentDao.delete(comment);
+ }
+
+ } else if (action.equals("disableUser")) {
+ // Un utilisateur "désactivé" ne peut plus se connecter mais il existe toujours
+ Web_user user = userDao.find(id);
+ // On s'assure que l'utilisateur n'est pas admin, ni désactivé
+ if (user != null && !user.isAdmin() && !user.isDeleted()) {
+ userDao.updateStatus(user.getId(), Web_user.DESACTIVE);
+ }
+
+ } else if (action.equals("enableUser")) {
+ // Réactive un compte UNIQUEMENT si le compte est désactivé
+ Web_user user = userDao.find(id);
+ if (user != null && user.isDisabled()) {
+ userDao.updateStatus(user.getId(), Web_user.USER);
+ }
+
+ } else if (action.equals("deleteUser")) {
+ // Si l'utilisateur est supprimé, il ne peut pas se connecter ni ré-utiliser son email
+ Web_user user = userDao.find(id);
+ if (user != null && !user.isAdmin()) {
+ userDao.updateStatus(user.getId(), Web_user.SUPPRIME);
+ }
+ }
+ resp.sendRedirect(req.getContextPath() + "/admin");
}
}
diff --git a/src/main/webapp/WEB-INF/admin.jsp b/src/main/webapp/WEB-INF/admin.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..1447ffae43e88180abdbbd06f967baa3891cc810
--- /dev/null
+++ b/src/main/webapp/WEB-INF/admin.jsp
@@ -0,0 +1,167 @@
+<%--
+ Document : admin
+ Created on : Oct 13, 2026, 6:23:05 PM
+ Author : Axel L.
+--%>
+
+<%@page contentType="text/html" pageEncoding="UTF-8"%>
+
+
+
+
+ Administration
+ "/>
+
+
+ <%@include file="jspf/header.jspf" %>
+
+
+ Bienvenue au poste de contrôle du park. Ici, tu gères les vidéos,
+ tu tranches sur les commentaires signalés et tu gardes un oeil sur les inscrits.
+ Un seul mot d'ordre : le respect du spot
+
+ <%-- ============ Partie vidéo ============ --%>
+
+ Les vidéos
+
+
+
+
+ Titre
+ Auteur
+ Actions
+
+
+
+
+
+
+
+
">Voir
+
+ <%-- Mini formulaire : "action" permet de connaitre l'action souhaitée, "id" permet de connaitre l'id de la vidéo --%>
+
" method="post"
+ onsubmit="return confirm('Supprimer cette vidéo, ses votes et ses commentaires ?');">
+
+
+
Supprimer
+
+
+
+
+
+
+
+
+
+ Aucune vidéo pour le moment.
+
+
+
+ <%-- ============ Partie commentaires signalés ============ --%>
+
+ Les commentaires signalés
+
+
+
+
+ Auteur
+ Commentaire
+ Actions
+
+
+
+
+
+
+
+
">Voir
+
+
" method="post">
+
+
+
Valider
+
+
+
" method="post"
+ onsubmit="return confirm('Supprimer ce commentaire ?');">
+
+
+
Supprimer
+
+
+
+
+
+
+
+
+
+ Aucun commentaire signalé
+
+
+
+ <%-- ============ Partie utilisateurs inscrits ============ --%>
+
+ Les inscrits
+
+
+
+
+ Pseudo
+ E-mail
+ Statut
+ Actions
+
+
+
+
+
+ <%-- Le statut (user, admin, desactive ou supprime) + la classe CSS "badge-xxx" change la couleur --%>
+
+
+
+
+ <%-- Un utilisateur actif : on peut le désactiver ou le supprimer --%>
+
+ " method="post">
+
+
+ Désactiver
+
+ " method="post"
+ onsubmit="return confirm('Supprimer ce compte ? Son e-mail ne pourra plus être réutilisé.');">
+
+
+ Supprimer
+
+
+
+ <%-- Un utilisateur désactivé : on peut le réactiver ou le supprimer --%>
+
+ " method="post">
+
+
+ Réactiver
+
+ " method="post"
+ onsubmit="return confirm('Supprimer ce compte ? Son e-mail ne pourra plus être réutilisé.');">
+
+
+ Supprimer
+
+
+
+ <%-- Un administrateur ou un compte supprimé : aucun bouton --%>
+
+
+
+
+
+
+
+
+
+ <%@include file="jspf/footer.jspf" %>
+
+
diff --git a/src/main/webapp/assets/css/admin-style.css b/src/main/webapp/assets/css/admin-style.css
new file mode 100644
index 0000000000000000000000000000000000000000..8419aa19ada471d076935d9a353870c222a2fd01
--- /dev/null
+++ b/src/main/webapp/assets/css/admin-style.css
@@ -0,0 +1,563 @@
+/*
+ Created on : Oct 13, 2026, 6:38:12 PM
+ Author : Axel L.
+*/
+html,
+body {
+ margin: 0;
+ min-height: 100%;
+}
+
+body {
+ margin: 0;
+ min-height: 100vh;
+ display: flex;
+ flex-direction: column;
+ background-color: #222528;
+ background-image: url("../img/background.png");
+ background-size: 100% auto;
+ background-repeat: repeat-y;
+ background-position: top center;
+
+}
+
+main {
+ flex: 1;
+}
+
+/* Main navbar */
+nav {
+ height: 80px;
+ box-sizing: border-box;
+ background-color: #222528;
+ display: flex;
+ align-items: center;
+ padding: 5px 100px;
+ gap: 30px;
+}
+
+/* Logo on the left */
+nav > img {
+ height: 65px;
+ object-fit: contain;
+ flex-shrink: 0;
+ height: 190px;
+ position: relative;
+ top: 51px;
+ transform: rotate(20deg);
+ filter:
+ drop-shadow(3px 4px 2px rgba(250, 138, 41, 0.25))
+ drop-shadow(6px 8px 7px rgba(250, 138, 41, 0.18))
+ drop-shadow(4px 6px 5px rgba(0, 0, 0, 0.12));
+}
+
+/* Large div filling the remaining space */
+.nav-content {
+ display: flex;
+ align-items: center;
+ justify-content: space-around;
+ width: fit-content;
+ margin-left: auto;
+ height: 60px;
+ padding: 0 20px;
+ box-sizing: border-box;
+ background-color: black;
+ border-radius: 50px;
+ gap: 15px;
+}
+
+/* Navigation links */
+.nav-content a {
+ text-decoration: none;
+ color: white;
+ font-family: Inter;
+ transition: color 0.2s ease;
+}
+
+.nav-content a:hover {
+ color: #00F3FB;
+}
+
+.nav-content h3 {
+ margin: 0 20px;
+ font-weight: bold;
+ font-size: 22px;
+}
+
+/* Avatar on the right */
+.nav-content img {
+ width: 42px;
+ height: 42px;
+ object-fit: cover;
+ border-radius: 50%;
+ flex-shrink: 0;
+
+ .avatar-link {
+ display: flex;
+ align-items: center;
+ flex-shrink: 0;
+ }
+
+ .avatar-link img {
+ width: 42px;
+ height: 42px;
+ object-fit: cover;
+ border-radius: 50%;
+ }
+}
+
+.calltoaction {
+ background-image: url("../img/calltoaction.png");
+ padding: 40px;
+ padding-top: 100px;
+ color: white;
+ font-size: 20px;
+ font-weight: bold;
+}
+
+.calltoaction h4 {
+ margin-top: 0;
+ font-family: 'Permanent Marker', cursive;
+ font-size: 45px;
+}
+
+/* Container for both buttons */
+.button-container {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: 150px;
+ flex-wrap: wrap;
+ margin-top: 50px;
+ margin-bottom: 20px;
+}
+
+/* Shared button styling */
+.blueButton,
+.pinkButton {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ font-family: 'Permanent Marker', cursive;
+ padding: 14px 28px;
+ border-radius: 30px;
+ text-decoration: none;
+ font-size: 25px;
+ font-weight: 600;
+ border: 2px solid transparent;
+ transition: all 0.3s ease;
+}
+
+/* Blue button */
+.blueButton {
+ background-color: #167ac6;
+ color: black;
+ border-color: #62c5ff;
+ box-shadow:
+ 0 0 8px #62c5ff,
+ 0 0 18px #3498db,
+ 0 0 35px #3498db,
+ 0 0 55px rgba(52, 152, 219, 0.8);
+}
+
+/* Pink button */
+.pinkButton {
+ background-color: #d9297d;
+ color: black;
+ border-color: #ff9ed0;
+ box-shadow:
+ 0 0 8px #ff9ed0,
+ 0 0 18px #e84393,
+ 0 0 35px #e84393,
+ 0 0 55px rgba(232, 67, 147, 0.8);
+}
+
+.yellowButton {
+ display: inline-block;
+ padding: 12px 24px;
+
+ background-color: #ffd500;
+ color: #222;
+ font-family: 'Permanent Marker', cursive;
+ text-decoration: none;
+ text-align: center;
+ font-weight: bold;
+ font-size: 16px;
+ margin-top: -30px;
+
+ border: 2px solid #fff176;
+ border-radius: 45px;
+
+ box-shadow:
+ 0 0 5px #ffeb3b,
+ 0 0 10px #ffd500,
+ 0 0 20px rgba(255, 213, 0, 0.7);
+}
+
+/* Hover effects */
+.blueButton:hover,
+.pinkButton:hover {
+ transform: translateY(-2px);
+ opacity: 0.9;
+}
+
+h2 {
+ font-size: 30px;
+ margin: 20px;
+ color: white;
+ font-family: 'Permanent Marker', cursive;
+}
+
+.videos-container {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 30px;
+ width: 100%;
+ padding: 0 30px;
+ margin-bottom: 40px;
+ box-sizing: border-box;
+ align-items: flex-start;
+}
+
+.video {
+ flex: 0 0 calc((100% - 60px) / 3);
+ padding: 10px;
+ min-width: 0;
+ box-sizing: border-box;
+ border-radius: 12px;
+ overflow: visible;
+ color: white;
+ background-color: black;
+ /* Blue neon glow */
+ border: 2px solid #62c5ff;
+ box-shadow:
+ 0 0 5px #62c5ff,
+ 0 0 10px #3498db,
+ 0 0 18px rgba(52, 152, 219, 0.6);
+}
+
+/* YouTube video */
+.video-player {
+ width: 100%;
+ aspect-ratio: 16 / 9;
+ border-radius: 12px;
+ overflow: hidden;
+}
+
+.video-player iframe {
+ display: block;
+ width: 100%;
+ height: 100%;
+ border: 0;
+}
+
+.video-player img {
+ display: block;
+ width: 100%;
+ height: 100%;
+ object-fit: contain;
+}
+
+/* Title */
+.video h5 {
+ margin: 12px 0;
+ font-size: 18px;
+}
+
+/* Vote and comment statistics */
+.video-stats {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ width: 100%;
+}
+
+.stat {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+}
+
+.stat img {
+ width: 24px;
+ height: 24px;
+ object-fit: contain;
+}
+
+.stat p {
+ margin: 0;
+}
+
+/* STATS VIDEO */
+.stat img {
+ width: 24px;
+ height: 24px;
+ object-fit: contain;
+}
+
+.stat p {
+ margin: 0;
+ color: white;
+ font-size: 16px;
+}
+
+
+footer {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 15px 50px;
+ margin-top: auto;
+ min-height: 60px;
+ box-sizing: border-box;
+ background-color: #222528;
+ color: white;
+}
+
+footer p {
+ margin: 0;
+ font-size: 14px;
+}
+
+.footer-link {
+ display: flex;
+ align-items: center;
+}
+
+.footer-link img {
+ object-fit: contain;
+}
+
+/*------------------- JSP REGISTER / LOGIN ------------ */
+
+.textRegister, .textLogin{
+ color: white;
+ font-family: 'Permanent Marker', cursive;
+ font-size: 20px;
+}
+
+.mainRegister, .mainLogin{
+ margin: 20px 70px 20px 70px;
+}
+
+.register-container, .login-container {
+ background-color: black;
+ padding: 50px;
+ border-radius: 24px;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ gap: 40px;
+ margin: 20px 70px;
+}
+
+.imgRegister, .imgLogin {
+ width: 40%;
+ height: auto;
+}
+
+.formRegister, .formLogin{
+
+ color: white;
+ flex: 1;
+}
+
+.noLabel{
+ width: 187px;
+ height: 62px;
+ background-color: #00f3fb;
+ border-radius: 50px;
+ box-shadow: 0px 6px 4px 6px rgba(0, 243, 251, 0.25), 0px -6px 4px 0px rgba(0, 243, 251, 0.25), 6px 0px 4px 0px rgba(0, 243, 251, 0.25), -6px 0px 4px 0px rgba(0, 243, 251, 0.25);
+ display: flex;
+ flex-direction: row;
+ font-size: 25px;
+ font-family: 'Permanent Marker', cursive;
+ margin-top: 20px;
+
+}
+
+.labelRegister, .labelLogin{
+ display:inline-block;
+ width: 250px;
+ margin-bottom: 10px;
+}
+
+.mandatory {
+ color: #FB3FA6;
+}
+
+.error{
+ color: #FB3FA6;
+}
+
+/*------------------- JSP LOGIN ------------ */
+
+.success{
+ color:#DBFA19
+}
+
+
+/*------------------- JSP ADMIN ------------ */
+
+.mainAdmin {
+ margin: 20px 70px;
+ padding-top: 100px;
+}
+
+.textAdmin {
+ color: white;
+ font-family: 'Permanent Marker', cursive;
+ font-size: 20px;
+}
+
+.admin-container {
+ background-color: black;
+ color: white;
+ padding: 20px 40px 30px 40px;
+ margin: 30px 0;
+ border-radius: 24px;
+ border: 2px solid #62c5ff;
+ box-shadow:
+ 0 0 5px #62c5ff,
+ 0 0 10px #3498db,
+ 0 0 18px rgba(52, 152, 219, 0.6);
+}
+
+.admin-alert {
+ border-color: #ff9ed0;
+ box-shadow:
+ 0 0 5px #ff9ed0,
+ 0 0 10px #e84393,
+ 0 0 18px rgba(232, 67, 147, 0.6);
+}
+
+.admin-container h2 {
+ margin: 10px 0 20px 0;
+}
+
+/* au lieu d'allonger toute la page, crée un défilement dans le tableau */
+.table-wrap {
+ max-height: 400px;
+ overflow-y: auto;
+ overflow-x: auto;
+ scrollbar-width: thin;
+ scrollbar-color: #00F3FB black;
+}
+
+.adminTable {
+ width: 100%;
+ border-collapse: separate; /* pour que la ligne suive pendant le défilement */
+ border-spacing: 0;
+}
+
+.adminTable th {
+ text-align: left;
+ padding: 10px 12px;
+ color: #00F3FB;
+ font-family: 'Permanent Marker', cursive;
+ font-size: 18px;
+ font-weight: normal;
+ border-bottom: 2px solid #00F3FB;
+ position: sticky;
+ top: 0;
+ background-color: black;
+}
+
+.adminTable td {
+ padding: 12px;
+ border-bottom: 1px solid #3a3d41;
+ vertical-align: middle;
+ word-break: break-word;
+}
+
+.adminActions {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ flex-wrap: wrap;
+}
+
+.adminActions form {
+ margin: 0;
+}
+
+.smallButton {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ font-family: 'Permanent Marker', cursive;
+ font-size: 15px;
+ padding: 6px 16px;
+ border-radius: 30px;
+ border: 2px solid transparent;
+ color: black;
+ text-decoration: none;
+ cursor: pointer;
+ transition: all 0.3s ease;
+}
+
+.smallButton:hover {
+ transform: translateY(-2px);
+ opacity: 0.9;
+}
+
+.smallBlue {
+ background-color: #167ac6;
+ border-color: #62c5ff;
+ box-shadow: 0 0 6px #62c5ff, 0 0 14px #3498db;
+}
+
+.smallPink {
+ background-color: #d9297d;
+ border-color: #ff9ed0;
+ box-shadow: 0 0 6px #ff9ed0, 0 0 14px #e84393;
+}
+
+.smallYellow {
+ background-color: #ffd500;
+ border-color: #fff176;
+ box-shadow: 0 0 6px #ffeb3b, 0 0 14px #ffd500;
+}
+
+.smallLime {
+ background-color: #DBFA19;
+ border-color: #efff85;
+ box-shadow: 0 0 6px #efff85, 0 0 14px #DBFA19;
+}
+
+/* Le statut d'un utilisateur : user, admin, desactive ou supprime */
+.badge {
+ display: inline-block;
+ padding: 3px 12px;
+ border: 2px solid;
+ border-radius: 20px;
+ font-size: 14px;
+ font-weight: bold;
+}
+
+.badge-user {
+ color: #62c5ff;
+ border-color: #62c5ff;
+}
+
+.badge-admin {
+ color: #FB3FA6;
+ border-color: #FB3FA6;
+}
+
+.badge-desactive {
+ color: #ffd500;
+ border-color: #ffd500;
+}
+
+.badge-supprime {
+ color: #999999;
+ border-color: #999999;
+}
+
+.adminEmpty {
+ color: #bbbbbb;
+ font-style: italic;
+ margin: 15px 0 0 0;
+}
+