fix(DevWeb): Import static files

This commit is contained in:
Lucàs
2024-04-05 12:39:01 +02:00
parent c438395a1a
commit 61603ddac6
26 changed files with 36 additions and 170 deletions
@@ -7,9 +7,9 @@
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<style><%@include file="../static/css/navbar.css"%></style>
<style><%@include file="/static/css/navbar.css"%></style>
<nav>
<a href="index"><img src="${pageContext.request.contextPath}/api/imgGet?imgName=CardRushLogo.png" alt="Logo CardsRush"> </a>
<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 -->
@@ -1,16 +1,8 @@
<%@ page import="uppa.project.pojo.User" %>
s<%@ page import="uppa.project.pojo.User" %>
<%@ page import="uppa.project.pojo.Game" %>
<%@ page import="uppa.project.pojo.Deck" %>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%--
Created by IntelliJ IDEA.
User: kmitr
Date: 19/03/2024
Time: 15:47
To change this template use File | Settings | File Templates.
--%>
<div id="newGameModal" class="modal-wrapper" style="display: none">
<div class="modal">
<a href="#close" title="Close" class="close">&times;</a>
@@ -5,13 +5,7 @@
<%@ page import="java.util.Date" %>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%--
Created by IntelliJ IDEA.
User: kmitr
Date: 26/03/2024
Time: 11:05
To change this template use File | Settings | File Templates.
--%>
<%--TODO: adapter les deux lignes suivante pour ne pas vérifier la valeur nulle--%>
<% User user = (User) session.getAttribute("user") != null ? (User) session.getAttribute("user") : new User("toto", "toto@gmail.com", "totopassword", new Date(), User.Gender.MALE); %>
<% ArrayList<Game> games = (ArrayList<Game>) request.getAttribute("games") != null ? (ArrayList<Game>) request.getAttribute("games") : new ArrayList<Game>() ; %>
@@ -1,27 +0,0 @@
html, body {
width: 100%;
height: 100%;
}
#main {
display: flex;
flex-direction: column;
align-items: center;
}
#Title {
text-align: center;
justify-self: center;
font-size: xxx-large;
}
.main-button {
display: flex;
flex-direction: column;
width: 180px;
}
input {
font-size: x-large;
margin: 10px 0;
}
@@ -1,80 +0,0 @@
html {
height: 100%;
display: flex;
align-items: center;
}
body {
width: 100%;
}
main {
width: 100%;
height: 100%;
display: flex;
flex-direction: row;
align-items: center;
}
/*Common */
hr {
width: 100%;
}
.border-left {
border-left: ridge;
padding-left: 6%;
}
/*Section titre*/
#title {
width:60%;
text-align: center;
font-size: xxx-large;
}
/*Section login / register*/
#form {
display: flex;
flex-direction: row;
height: 100%;
}
h1 {
justify-self: center;
}
.flex-column {
display: flex;
flex-direction: column;
justify-content: left;
}
.login-gap {
gap: 20px;
}
.register-gap {
gap: 75px;
}
#login-form, #register-form {
display: grid;
grid-template-columns: 1fr 1fr;
grid-gap: 8% 2%;
}
#login-submit {
grid-column: 2/2;
grid-row: 3/3;
justify-self: right;
}
#register-submit {
grid-column: 2/2;
grid-row: 7/7;
justify-self: right;
}
@@ -1,72 +0,0 @@
body {
font-family: sans-serif;
padding: 30px;
}
.demo-description {
max-width: 460px;
margin: 0 auto;
line-height: 1.5;
}
.modal-toggle {
cursor: pointer;
color: #268bd2;
}
.modal-wrapper {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0, 0, 0, 0.8);
display: none;
-webkit-transition: opacity 0.2s ease-in;
-moz-transition: opacity 0.2s ease-in;
transition: opacity 0.2s ease-in;
pointer-events: auto;
}
.modal-wrapper > div {
width: 460px;
height: 40%;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
vertical-align: middle;
padding: 20px;
border-radius: 6px;
background: #fff;
display: none;
}
.close {
background: #606061;
color: #ffffff;
line-height: 25px;
position: absolute;
right: -12px;
text-align: center;
top: -10px;
width: 24px;
text-decoration: none;
font-weight: bold;
-webkit-border-radius: 12px;
-moz-border-radius: 12px;
border-radius: 12px;
}
.close:hover {
background: #00d9ff;
}
@@ -1,5 +0,0 @@
nav {
display: flex;
justify-content: right;
padding: 10px;
}
@@ -1,13 +0,0 @@
const ERROR_MESSAGE = {
"expired-token": "Lien expiré, veuillez recommencer la procédure de récupération de mot de passe.",
"invalid-token": "Lien invalide, veuillez recommencer la procédure de récupération de mot de passe.",
};
const urlParams = new URLSearchParams(window.location.search);
const error = urlParams.get('error');
if (error) {
const errorMessage = ERROR_MESSAGE[error];
console.error(errorMessage);
window.alert(errorMessage);
}
@@ -1,29 +0,0 @@
const loginForm = document.getElementById("login-form");
loginForm.addEventListener("submit", (event) => {
event.preventDefault();
const formData = new FormData(loginForm);
const data = {};
formData.forEach((value, key) => data[key] = value);
fetch(loginForm.getAttribute("action"), {
headers: {"Content-Type": "application/json"},
body: JSON.stringify(data),
method: loginForm.getAttribute("method"),
})
.then(res => res.json())
.then(d => window.location.href = "./main-menu")
.catch(error => console.error("Error:", error));
});
const urlParams = new URLSearchParams(window.location.search);
if (urlParams.has('success')) {
if (urlParams.get('success') === "account-created") {
window.alert("Compte créé avec succès.");
}
if (urlParams.get('success') === "password-reseted") {
window.alert("Mot de passe réinitialisé avec succès.");
}
}
@@ -1,16 +0,0 @@
var cb = document.querySelectorAll(".close");
for (i = 0; i < cb.length; i++) {
cb[i].addEventListener("click", function() {
var dia = this.parentNode.parentNode; /* You need to update this part if you change level of close button */
dia.style.display = "none";
});
}
var mt = document.querySelectorAll(".modal-toggle");
for (i = 0; i < mt.length; i++) {
mt[i].addEventListener("click", function() {
var targetId = this.getAttribute("data-target");
var target = document.querySelector(targetId);
target.style.display = "block";
});
}
@@ -1,19 +0,0 @@
const nbColorsElement = document.getElementById("nbColors");
const nbValuesElement = document.getElementById("nbValues");
const nbRoundsElement = document.getElementById("nbRounds")
/**
* Mise à jour du nombre de rounds max en fonction du nombre de couleurs et de valeurs séléctionnés
*/
function updateOnChange() {
nbRoundsElement.max = nbColorsElement.value * nbValuesElement.value;
nbRoundsElement.value =
(nbRoundsElement.value > nbRoundsElement.max)
? nbRoundsElement.max
: nbRoundsElement.value
;
}
nbColorsElement.addEventListener("change", updateOnChange);
nbValuesElement.addEventListener("change", updateOnChange);
@@ -1,21 +0,0 @@
const registerForm = document.getElementById("register-form");
const confirmPassword = document.getElementById("confirmPassword");
registerForm.addEventListener("submit", (event) => {
event.preventDefault();
const formData = new FormData(registerForm);
const data = {};
formData.forEach((value, key) => data[key] = value);
fetch(registerForm.getAttribute("action"), {
method: registerForm.getAttribute("method"),
headers: {"Content-Type": "application/json"},
body: JSON.stringify(data)
})
.then(res => res.json())
.then(_ => {
window.location.href = "./login"
})
.catch(error => console.error("Error: " + error))
});
@@ -1,31 +0,0 @@
const resetPasswordForm = document.getElementById("resetPasswordForm");
const confirmPassword = document.getElementById("confirmPassword");
resetPasswordForm.addEventListener("submit", function (event) {
event.preventDefault();
const formData = new FormData(resetPasswordForm);
const data = {};
formData.forEach((value, key) => data[key] = value);
const action = loginForm.getAttribute("action")
const method = loginForm.getAttribute("method")
fetch("/reset-password", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(data)
}).then(response => {
if (response.ok) {
window.location.href = "/login";
} else {
response.json().then(data => {
alert(data.message);
});
}
}).catch(error => {
console.error("Error:", error);
});
});
@@ -9,6 +9,9 @@
<html>
<head>
<title>Forgotten Password</title>
<meta charset="UTF-8">
<%-- <link href="${pageContext.request.contextPath}/static/css/forgotten-password.css" rel="stylesheet">--%>
<script src="${pageContext.request.contextPath}/static/js/forgotten-password.js" defer></script>
</head>
<body>
<main>
@@ -26,5 +29,4 @@
<%}%>
</main>
</body>
<script defer type="module"><%@include file="../static/js/forgotten-password.js"%></script>
</html>
@@ -3,7 +3,8 @@
<html>
<head>
<title> Cards Rush - Connexion</title>
<style><%@include file="../static/css/login.css" %></style>
<link href="${pageContext.request.contextPath}/static/css/login.css" rel="stylesheet">
<script src="${pageContext.request.contextPath}/static/js/login.js" defer></script>
<meta charset="utf-8">
</head>
<body>
@@ -35,8 +36,5 @@
</div>
</section>
</main>
<script defer type="module"><%@include file="../static/js/login.js" %></script>
</body>
</html>
@@ -5,6 +5,9 @@
<html>
<head>
<title>Cards Rush</title>
<%-- <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">
</head>
<body>
@@ -21,6 +24,4 @@
<%@include file="../components/new-game.jsp"%>
<%@include file="../components/statistics.jsp"%>
</body>
<script defer type="text/javascript"><%@include file="../static/js/modal.js"%></script>
<script defer type="text/javascript"><%@include file="../static/js/new-game.js"%></script>
</html>
@@ -3,7 +3,8 @@
<html>
<head>
<title>Register</title>
<style><%@include file="../static/css/login.css"%></style>
<link href="${pageContext.request.contextPath}/static/css/login.css" rel="stylesheet">
<script src="${pageContext.request.contextPath}/static/js/register.js" defer></script>
</head>
<body>
@@ -51,5 +52,4 @@
</main>
</body>
<script defer type="module"><%@include file="../static/js/register.js"%></script>
</html>
@@ -1,29 +1,26 @@
<%@ page import="uppa.project.dao.jpa.DAO_JPA_RecoveryPasswordToken" %>
<%@ page import="uppa.project.pojo.RecoveryPasswordToken" %>
<%@ page import="uppa.project.dao.DAOException" %>
<%--
Created by IntelliJ IDEA.
User: kmitr
Date: 22/03/2024
Time: 13:48
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Récupération du mot de passe</title>
<meta charset="UTF-8">
<%-- <link href="${pageContext.request.contextPath}/static/css/reset-password.css" rel="stylesheet">--%>
<script src="${pageContext.request.contextPath}/static/js/reset-password.js" defer></script>
</head>
<body>
<main>
<jsp:include page="../components/navbar.jsp"/>
<h1>Récupération du mot de passe</h1>
<form id="resetPasswordForm" action="reset-password" method="post">
<form id="resetPasswordForm" action="${pageContext.request.contextPath}/reset-password" method="post">
<label for="newPassword">Nouveau mot de passe</label>
<input type="password" id="newPassword" name="newPassword" required>
<label for="confirmPassword">Confirmer le mot de passe</label>
<input type="password" id="confirmPassword" name="confirmPassword" required>
<% if (request.getParameter("error") != null && request.getParameter("error").equals("matching-password")) {%>
<p>Les mots de passe ne correspondent pas</p>
<p>Les mots de passe ne correspondent pas</p>
<% } %>
<input type="hidden" name="token" value="${param.token}">
<input type="submit" value="Valider">