summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDebulois <quentin@debulois.fr>2022-04-06 21:37:53 +0200
committerDebulois <quentin@debulois.fr>2022-04-06 21:37:53 +0200
commit6ee8ad125692175ddfb705080a4bc54b76c5a4f6 (patch)
treed8321eab73354eeea2b2ca7ea5ee16175a71ff43
parent5582d242d03692a7e1b2c631e1b4ff3f52e8b72c (diff)
Finalisation, affinage du css et ajout d'un système de vérification pour les mdp pour qu'ils soient forts.
-rw-r--r--Core/Functions/func_register.php47
-rw-r--r--Core/wrapper.php1
-rw-r--r--Static/Css/admin.css8
-rw-r--r--Static/Css/footer.css8
-rw-r--r--Static/Css/login.css8
-rw-r--r--Static/Css/main.css74
-rw-r--r--Static/Css/message.css13
-rw-r--r--Static/Css/mission.css12
-rw-r--r--Static/Css/myMission.css8
-rw-r--r--Static/Css/navbar.css44
-rw-r--r--Static/Css/register.css56
-rw-r--r--Static/Css/search.css21
-rw-r--r--Static/Css/slideshow.css16
-rw-r--r--Static/Css/userInfo.css37
-rw-r--r--Static/Js/index.js12
-rw-r--r--Static/Js/main.js26
-rw-r--r--Static/Js/message.js15
-rw-r--r--Static/Js/register.js43
-rw-r--r--Static/Js/userinfo.js37
-rw-r--r--Template/Include/en/text.php25
-rw-r--r--Template/Include/fr/message.php2
-rw-r--r--Template/Include/fr/text.php27
-rw-r--r--Template/Include/incl_form_register.php39
-rw-r--r--Template/Include/incl_global_navbar.php26
-rw-r--r--Template/Include/incl_index_search.php11
-rw-r--r--Template/Include/incl_table_myMission.php39
-rw-r--r--Template/register.php1
27 files changed, 455 insertions, 201 deletions
diff --git a/Core/Functions/func_register.php b/Core/Functions/func_register.php
index f7686e7..d8960ce 100644
--- a/Core/Functions/func_register.php
+++ b/Core/Functions/func_register.php
@@ -7,24 +7,43 @@
// ############################################################################
function register($email, $password, $userStatus) {
- $dbuser = new DbUser;
-
- $registered = $dbuser->register_user($email,
- $password,
- $userStatus
- );
+ // les regex necessaire pour vérifier le mot de passe
+ $numb = "/[0-9]/";
+ $upper = "/[A-Z]/";
+ $special = "/[`!@#$%^&*()_+\-=\[\]{};':\"\\|,.<>\/?~µ°€£]/";
- // Sélection du message à afficher en fonction de la réussite de l'inscription.
- if ($registered) {
- $message = ["userAdd", "success"];
+ if ((strlen($password) >= 8)
+ && preg_match($numb, $password)
+ && preg_match($upper, $password)
+ && preg_match($special, $password)
+ ) {
+ $dbuser = new DbUser;
+
+ $registered = $dbuser->register_user($email,
+ $password,
+ $userStatus
+ );
+
+ // Sélection du message à afficher en fonction de la réussite de l'inscription.
+ if ($registered) {
+ $message = ["userAdd", "success"];
+ } else {
+ $message = ["userAdd", "fail"];
+ }
+
+ // Redirection vers message avec l'index du message à afficher.
+ $_SESSION["message"] = $message;
+ header("Location: /Template/message.php");
+ die();
} else {
+ // Si le mdp est arrivé jusque là et est insuffisament "fort"
$message = ["userAdd", "fail"];
+
+ // Redirection vers message avec l'index du message à afficher.
+ $_SESSION["message"] = $message;
+ header("Location: /Template/message.php");
+ die();
}
-
- // Redirection vers message avec l'index du message à afficher.
- $_SESSION["message"] = $message;
- header("Location: /Template/message.php");
- die();
}
?> \ No newline at end of file
diff --git a/Core/wrapper.php b/Core/wrapper.php
index ea4be30..0fcc47e 100644
--- a/Core/wrapper.php
+++ b/Core/wrapper.php
@@ -117,7 +117,6 @@ if (isset($_SESSION["src"])) {
} elseif ($_SESSION["src"] == "autoLogin"
&& isset($_COOKIE["autoLogin"])
- && $_SESSION["loggedIn"]
) {
// Si connection par cookie, on le décode avant de le passer à la fonction.
login(json_decode(base64_decode($_COOKIE["autoLogin"])));
diff --git a/Static/Css/admin.css b/Static/Css/admin.css
index b92ae2c..96d9c03 100644
--- a/Static/Css/admin.css
+++ b/Static/Css/admin.css
@@ -1,4 +1,12 @@
+/*
+############################################################################
+# #
+# Description: CSS spécifique de l'administration #
+# #
+############################################################################
+*/
+
/* BUTTONS */
#adminButtons {
display: flex;
diff --git a/Static/Css/footer.css b/Static/Css/footer.css
index b806b47..d0e4c02 100644
--- a/Static/Css/footer.css
+++ b/Static/Css/footer.css
@@ -1,4 +1,12 @@
+/*
+############################################################################
+# #
+# Description: CSS spécifique du footer #
+# #
+############################################################################
+*/
+
/* FOOTER */
footer {
min-height: 10vh;
diff --git a/Static/Css/login.css b/Static/Css/login.css
index 915b5f6..0b373b1 100644
--- a/Static/Css/login.css
+++ b/Static/Css/login.css
@@ -1,4 +1,12 @@
+/*
+############################################################################
+# #
+# Description: CSS spécifique de la page de login #
+# #
+############################################################################
+*/
+
/* MAIN */
#mainLogin form {
display: flex;
diff --git a/Static/Css/main.css b/Static/Css/main.css
index a602db3..ff1e229 100644
--- a/Static/Css/main.css
+++ b/Static/Css/main.css
@@ -1,4 +1,12 @@
/*
+############################################################################
+# #
+# Description: Fichier principal regroupant les éléments communs à toutes #
+# les pages. #
+# #
+############################################################################
+
+
Sites web utilisés pour le CSS:
https://css-tricks.com/guides/
https://stackoverflow.com/
@@ -9,43 +17,46 @@ sur mon instance SearX https://searx.debulois.fr
*/
:root {
+ /* Global */
--mainSiteColor: #c0392b;
--bodyBg: #fafafa;
--separatorBg: var(--bodyBg);
--bg: white;
--text: black;
-
+ /* Header & navbar */
--navbarTextColor: var(--text);
--headerBg: var(--bg);
--navBg: #f8f8f8;
-
+ /* Slideshow */
--slideText: whitesmoke;
--slideBg: black;
--slideStroke: black;
-
+ /* Footer */
--footerTextColor: #636e72;
--footerBgColor: #2d3436;
-
- --iconColor: white;
- --btnHoverBg: #e74c3c;
-
+ /* Tableaux */
--tableText: var(--text);
--tableBg: var(--bodyBg);
--tdBorderColor: rgba(0, 0, 0, 0.2);
--tableStarUnchecked: darkgray;
--tableStarChecked: orange;
-
+ /* Messages */
--messageTextErrorColor: red;
--messageTextSuccessColor: green;
-
+ /* Input icon et button */
+ --iconColor: white;
+ --btnHoverBg: #e74c3c;
+ /* Input border */
--inputBorder: 2px solid var(--mainSiteColor);
--thBorder: 2px solid var(--mainSiteColor);
--tdBorder: 2px solid var(--tdBorderColor);
--iBorderRadius: 5px 0px 0px 5px;
--inputBorderRadius: 0px 5px 5px 0px;
-
+ /* Fonts size */
--fontSizeI: 20px;
--fontSizeSlideP: 34px;
+ --fontSizeSmallPhone: 12px;
+ --fontSizeSmallLess: 14px;
--fontSizeSmall: 16px;
--fontSizeSmallPlus: 18px;
--fontSizeMedium: 26px;
@@ -94,15 +105,16 @@ html {
}
body {
- font-family: SourceSansPro;
- font-size: var(--fontSizeSmall);
- margin: 0px;
- min-height: 100vh;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
+
+ min-height: 100vh;
+ font-family: SourceSansPro;
+ display: flex;
+ flex-direction: column;
+ justify-content: space-between;
+ margin: 0px;
background-color: var(--bodyBg);
color: var(--textColor);
+ font-size: var(--fontSizeSmall);
}
main {
@@ -120,24 +132,23 @@ main {
border-left: 3px solid var(--mainSiteColor);
border-radius: 3px;
background-color: var(--bg);
- color: var(--textColor);
}
main h2 {
max-width: 80%;
- font-size: var(--fontSizeLarge);
margin-left: auto;
margin-right: auto;
padding: 1.5% 3%;
+ font-size: var(--fontSizeLarge);
border-bottom: var(--mainSiteColor) 3px solid;
}
main h3 {
max-width: 80%;
- font-size: var(--fontSizeMedium);
margin-left: auto;
margin-right: auto;
padding: 0.5% 3%;
+ font-size: var(--fontSizeMedium);
border-bottom: var(--mainSiteColor) 2px solid;
}
@@ -161,16 +172,16 @@ main table {
display: block;
Overflow-x: auto;
Overflow-y: auto;
- color: var(--textColor);
padding: 1em;
border-collapse: collapse;
+ width: fit-content;
max-width: 95%;
margin-left: auto;
margin-right: auto;
+ color: var(--textColor);
}
main th {
- font-size: var(--fontSizeSmallPlus);
border: var(--thBorder);
background-color: var(--tableBg);
}
@@ -180,7 +191,6 @@ main td {
background-color: var(--tableBg);
}
-
select {
height: 1.6em;
line-height: 1.6em;
@@ -191,6 +201,9 @@ select {
main input[type="text"],
main input[type="email"],
main input[type="password"] {
+ padding: 2px;
+ height: 2.5em;
+ font-size: calc(32px / 2.5);
border: var(--inputBorder);
border-radius: var(--inputBorderRadius);
}
@@ -198,7 +211,6 @@ main input[type="password"] {
main input[type="submit"],
main button {
color: var(--textColor);
- font-size: var(--fontSizeSmall);
border: var(--inputBorder);
background-color: var(--bg);
border-radius: 5px;
@@ -212,3 +224,17 @@ main button:hover {
color: var(--bg);
background-color: var(--btnHoverBg);
}
+
+@media screen and (max-width: 768px) {
+ body {
+ font-size: var(--fontSizeSmallLess);
+ }
+
+ main h2 {
+ font-size: var(--fontSizeMedium);
+ }
+
+ main h3 {
+ font-size: var(--fontSizeSmallPlus);
+ }
+} \ No newline at end of file
diff --git a/Static/Css/message.css b/Static/Css/message.css
index 3ea29e3..d2276ea 100644
--- a/Static/Css/message.css
+++ b/Static/Css/message.css
@@ -1,17 +1,24 @@
+/*
+############################################################################
+# #
+# Description: CSS spécifique de la page des messages #
+# #
+############################################################################
+*/
+
.success {
- color: var(--messageTextSuccessColor);
font-weight: bold;
-
text-decoration: underline;
font-size: var(--fontSizeMedium);
+ color: var(--messageTextSuccessColor);
}
.error {
- color: var(--messageTextErrorColor);
font-weight: bold;
text-decoration: underline;
font-size: var(--fontSizeMedium);
+ color: var(--messageTextErrorColor);
}
#mainMessage h3 {
diff --git a/Static/Css/mission.css b/Static/Css/mission.css
index cd37466..b9383d9 100644
--- a/Static/Css/mission.css
+++ b/Static/Css/mission.css
@@ -1,10 +1,20 @@
+
+/*
+############################################################################
+# #
+# Description: CSS spécifique de la page d'enregistrement ou de valdation #
+# des missions #
+# #
+############################################################################
+*/
+
#mainMission form {
display: flex;
flex-direction: column;
+ align-items: center;
justify-content: space-around;
gap: 1em;
padding: 1.5% 5%;
- align-items: center;
}
#mainMission label {
diff --git a/Static/Css/myMission.css b/Static/Css/myMission.css
index 5b6ad2a..34afff3 100644
--- a/Static/Css/myMission.css
+++ b/Static/Css/myMission.css
@@ -1,4 +1,12 @@
+/*
+############################################################################
+# #
+# Description: CSS spécifique de la page de gestion de ses missions #
+# #
+############################################################################
+*/
+
#myMissionButtons {
display: flex;
justify-content: space-around;
diff --git a/Static/Css/navbar.css b/Static/Css/navbar.css
index 327cde8..6887f0d 100644
--- a/Static/Css/navbar.css
+++ b/Static/Css/navbar.css
@@ -1,11 +1,19 @@
+/*
+############################################################################
+# #
+# Description: CSS spécifique au header et à la navbar #
+# #
+############################################################################
+*/
+
.showNav {
top: 0vh !important;
}
.navLinkClicked {
+ color: var(--mainSiteColor) !important;
transform: scale(1.2) rotate(90deg);
- color: var(--mainSiteColor) !important;
}
.headerInfoAdmin {
@@ -21,30 +29,30 @@
}
header {
- z-index: 1;
- display: flex;
- justify-content: space-around;
+ z-index: 1;
+ display: flex;
+ justify-content: space-around;
height: 10vh;
- text-align: center;
+ text-align: center;
background-color: var(--headerBg);
border-top: var(--mainSiteColor) solid 6px;
border-bottom: var(--mainSiteColor) solid 3px;
}
header h2 {
+ margin: 0px;
font-family: akira;
color: var(--mainSiteColor) !important;
- margin: 0px;
}
header a {
- display: flex;
- flex-direction: column;
+ display: flex;
+ flex-direction: column;
justify-content: center;
- text-align: center;
+ text-align: center;
flex-grow: 1;
- color: var(--navbarTextColor);
text-decoration: none;
+ color: var(--navbarTextColor);
transition: all 0.1s ease-in-out;
}
@@ -59,14 +67,8 @@ header a:hover {
transform: scale(1.1);
}
-header i {
- all: revert;
- margin-right: 0.4em;
- font-size: var(--fontSizeI);
-}
-
header a:first-child {
- border-right: 3px solid var(--mainSiteColor);
+ border-right: 3px solid var(--mainSiteColor);
background-color: var(--navBg);
}
@@ -75,9 +77,9 @@ header a:first-child:hover {
}
header a:first-child i {
- color: #404040;
- font-size: var(--fontSizeLarge);
margin: 0px;
+ color: #404040;
+ font-size: var(--fontSizeLarge);
transition: all 0.1s ease-in-out;
}
@@ -91,8 +93,8 @@ nav {
position: relative;
justify-content: space-around;
height: 10vh;
- border-bottom: var(--mainSiteColor) solid 3px;
background-color: var(--navBg);
+ border-bottom: var(--mainSiteColor) solid 3px;
box-shadow: 0px 0px 6px #0e0e0e;
transition: all 0.1s ease-in-out;
}
@@ -103,8 +105,8 @@ nav a {
justify-content: center;
text-align: center;
flex-grow: 1;
- color: var(--navbarTextColor);
text-decoration: none;
+ color: var(--navbarTextColor);
transition: all 0.1s ease-in-out;
}
diff --git a/Static/Css/register.css b/Static/Css/register.css
index e9a5009..56808af 100644
--- a/Static/Css/register.css
+++ b/Static/Css/register.css
@@ -1,22 +1,70 @@
+/*
+############################################################################
+# #
+# Description: CSS spécifique à la page d'inscription #
+# #
+############################################################################
+*/
+
+.valid {
+ color: #338533;
+}
+
+.valid::before {
+ content: "\2714\0020";
+}
+
+.invalid::before {
+ content: "\2717\0020";
+}
+
+.deactivate {
+ border-color: darkgray !important;
+}
+
+.deactivate:hover {
+ color: black !important;
+ border-color: darkgray !important;
+ background-color: white !important;
+}
+
#mainRegister form {
display: flex;
flex-direction: column;
justify-content: space-around;
- gap: 1em;
- padding: 1.5% 5%;
align-items: center;
+ padding: 1.5% 5%;
}
#mainRegister label {
width: 70%;
}
-#mainRegister:last-child {
- justify-content: center !important;
+#mainRegister p {
+ margin: 0px;
+ font-style: italic;
+ color: #8f8f8f;
+ font-size: var(--fontSizeSmallLess);
+}
+
+#mainRegister div {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 0.5em;
}
#mainRegister input[type="email"],
#mainRegister input[type="password"] {
width: inherit;
}
+
+/* MOBILE */
+@media screen and (max-width: 768px) {
+ #mainRegister p {
+ display: flex;
+ flex-direction: column;
+ font-size: var(--fontSizeSmallPhone);
+ }
+} \ No newline at end of file
diff --git a/Static/Css/search.css b/Static/Css/search.css
index c9aa98b..7362ac9 100644
--- a/Static/Css/search.css
+++ b/Static/Css/search.css
@@ -1,3 +1,12 @@
+
+/*
+############################################################################
+# #
+# Description: CSS spécifique à la partie recherche de l'index #
+# #
+############################################################################
+*/
+
.star {
width: 1.2em !important;
background-color: var(--tableBg) !important;
@@ -14,15 +23,15 @@
/* DIV SEARCH */
#divSearch {
- width: 80%;
- margin-left: auto;
- margin-right: auto;
- padding-bottom: 1em;
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-around;
align-items: center;
+ width: 80%;
+ margin-left: auto;
+ margin-right: auto;
+ padding-bottom: 1em;
border-bottom: var(--mainSiteColor) 2px solid;;
}
@@ -36,7 +45,7 @@
}
#mainSearch p {
- font-size: var(--fontSizeSmallPlus);
+ font-size: var(--fontSizeSmallPlus);
font-style: italic;
}
@@ -61,9 +70,11 @@
.extend {
display: none;
}
+
#mainSearch form {
flex-direction: column;
}
+
#divSearch {
flex-direction: column;
}
diff --git a/Static/Css/slideshow.css b/Static/Css/slideshow.css
index c7c2e99..d2cdaa3 100644
--- a/Static/Css/slideshow.css
+++ b/Static/Css/slideshow.css
@@ -1,13 +1,21 @@
+/*
+############################################################################
+# #
+# Description: CSS spécifique au slideshow #
+# #
+############################################################################
+*/
+
.slideDotSelected {
color: var(--mainSiteColor);
transform: scale(1.4);
}
#secSlides {
- display: flex;
- flex-direction: column;
- text-align: center;
+ display: flex;
+ flex-direction: column;
+ text-align: center;
width: 100%;
height: 70vh;
background-color: var(--navbarBg);
@@ -19,8 +27,8 @@
}
#secSlides p {
- display: none;
z-index: 1;
+ display: none;
margin: auto;
max-width: 80%;
font-size: var(--fontSizeSlideP);
diff --git a/Static/Css/userInfo.css b/Static/Css/userInfo.css
index ceda91a..45d1133 100644
--- a/Static/Css/userInfo.css
+++ b/Static/Css/userInfo.css
@@ -1,7 +1,15 @@
+/*
+############################################################################
+# #
+# Description: CSS spécifique à la page de gestion de ses infos #
+# #
+############################################################################
+*/
+
.jobsListElem {
- background-color: rgb(243, 201, 201);
border-radius: 10px;
+ background-color: rgb(243, 201, 201);
transition: all 0.1s ease-in-out;
}
@@ -11,23 +19,22 @@
}
.jobsListElem i{
- background-color: transparent !important;
- color: #991e1e !important;
width: auto !important;
height: auto !important;
line-height: normal !important;
- font-size: var(--fontSizeSmall) !important;
border-radius: 0px !important;
- margin-left: 0.5em;
+ font-size: var(--fontSizeSmall) !important;
+ color: #991e1e !important;
+ background-color: transparent !important;
}
#mainUserInfo form {
display: flex;
flex-direction: column;
justify-content: space-around;
+ align-items: center;
gap: 1em;
padding: 1.5% 5%;
- align-items: center;
}
#mainUserInfo label {
@@ -35,20 +42,15 @@
}
#mainUserInfo input[type="text"] {
- width: inherit;
+ width: 70%;
}
#mainUserInfo button {
padding: 0.13em 0.2em;
}
-#userJob {
- justify-content: center;
- width: 70%;
-}
-
#userJob div {
- width: inherit;
+ width: 70%;
font-size: calc(36px / 2.5);
height: 2.5em;
line-height: 2.5em;
@@ -64,15 +66,16 @@
}
#jobsListGrid {
+ width: 70%;
display: grid;
+ gap: 0.5em;
+ grid-template-columns: repeat(3, 1fr);
min-height: 2em;
line-height: 2em;
- padding: 1px 2px;
- grid-template-columns: repeat(3, 1fr);
+ padding: 2px;
border: var(--inputBorder);
border-radius: 0px 4px 4px 0px;
- width: inherit;
- gap: 0.5em;
+ font-size: var(--fontSizeSmall);
}
@media screen and (max-width: 768px) {
diff --git a/Static/Js/index.js b/Static/Js/index.js
index a9889b2..31ee34f 100644
--- a/Static/Js/index.js
+++ b/Static/Js/index.js
@@ -1,9 +1,13 @@
+// ############################################################################
+// # #
+// # Description: JS uniquement utile dans l'index #
+// # #
+// ############################################################################
+
// ****************************************************************************
-// INDEX
+// SLIDESHOW
// ****************************************************************************
-
-// Slideshow
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters
function slideshow_start(slideNumber = 1) {
let images = [
@@ -15,8 +19,8 @@ function slideshow_start(slideNumber = 1) {
setInterval(() => {
// Changement de l'image de fond de de la div
document.getElementById("secSlides").style.backgroundImage = `url("${images[slideNumber]}")`;
- // Untoggle les précedents
// Utilisation de ternary, utilisation: condition ? Sivrai : Sifaux
+ // Untoggle les précedents
document.getElementById(`slide_${slideNumber !== 0 ? slideNumber - 1 : images.length - 1}`).classList.toggle("show_block");
document.getElementById(`slideDot_${slideNumber !== 0 ? slideNumber - 1 : images.length - 1}`).classList.toggle("slideDotSelected");
// Toggle le nouveau texte & selecteur
diff --git a/Static/Js/main.js b/Static/Js/main.js
index 7f3935c..3a6c3e5 100644
--- a/Static/Js/main.js
+++ b/Static/Js/main.js
@@ -1,17 +1,25 @@
-// ****************************************************************************
-// Main
-// ****************************************************************************
-
+
+// ############################################################################
+// # #
+// # Description: JS utile un peu de partout #
+// # #
+// ############################################################################
// Site web utilisés pour JS:
// https://www.w3schools.com/js/default.asp
// https://stackoverflow.com/
-// Changement de langue
+
+// ****************************************************************************
+// CHANGEMENT DE LANGUE
+// ****************************************************************************
document.getElementById("navSelLang").addEventListener("change", () => {
document.getElementById("navFormLang").submit();
});
-// TODO: A commenter
+
+// ****************************************************************************
+// TOGGLE UNE CLASSE SUR UN ELEMENT PARMIS PLUSIEURS IDENTIQUES
+// ****************************************************************************
function show(parentId, element, id, className) {
let elements = document.getElementById(parentId).getElementsByTagName(element);
elements[id].classList.add(className);
@@ -22,8 +30,12 @@ function show(parentId, element, id, className) {
}
}
+
+// ****************************************************************************
+// AFFICHER LA BAR DE NAVIGATION
+// ****************************************************************************
function showNavButtons() {
document.getElementsByTagName("nav")[0].classList.toggle("showNav")
// first-child à chaque fois
document.getElementsByTagName("header")[0].getElementsByTagName("a")[0].getElementsByTagName("i")[0].classList.toggle("navLinkClicked")
-} \ No newline at end of file
+}
diff --git a/Static/Js/message.js b/Static/Js/message.js
index 97f39ef..06ba511 100644
--- a/Static/Js/message.js
+++ b/Static/Js/message.js
@@ -1,14 +1,21 @@
+// ############################################################################
+// # #
+// # Description: JS utile sur la page des messages #
+// # #
+// ############################################################################
+
+
// ****************************************************************************
-// MESSAGES
+// REDIRECTION
// ****************************************************************************
-
-// Redirection
function redirect(page) {
window.location.href = `/${page}.php`;
}
-// Timer pour message
+// ****************************************************************************
+// DECLENCHEMENT DU TIMER POUR UNE REDIRECTION
+// ****************************************************************************
function start_timer(page) {
let seconds = 2;
let text = document.getElementById("redirect").innerHTML;
diff --git a/Static/Js/register.js b/Static/Js/register.js
new file mode 100644
index 0000000..c751b77
--- /dev/null
+++ b/Static/Js/register.js
@@ -0,0 +1,43 @@
+
+// ############################################################################
+// # #
+// # Description: JS de la partie inscription #
+// # #
+// ############################################################################
+
+// Regex pour vérifier la validité du mdp
+const numb = new RegExp(/[0-9]/)
+const upper = new RegExp(/[A-Z]/)
+const special = new RegExp(/[`!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~µ°€£]/)
+
+function is_valid(condition, element) {
+ // Si la regex est bonne on selectionne la class css pour l'afficher
+ if (condition) {
+ document.getElementById(element).classList.remove("invalid");
+ document.getElementById(element).classList.add("valid");
+ return true;
+ } else {
+ document.getElementById(element).classList.remove("valid");
+ document.getElementById(element).classList.add("invalid");
+ return false;
+ }
+}
+
+function check_pass() {
+ // On récupère les éléments dans la page et on test nos regex sur le mdp
+ let pass = document.getElementById("password").value;
+ let submitButton = document.getElementById("submit");
+ let validNumb = is_valid(numb.test(pass), "passNumb");
+ let validUpper = is_valid(upper.test(pass), "passUpper");
+ let validSpecial = is_valid(special.test(pass), "passSpecial");
+ let validLength = is_valid((pass.length >= 8), "passLength");
+
+ // Si tout est validé on active le button sumbit
+ if (validLength && validUpper && validNumb && validSpecial) {
+ submitButton.classList.remove("deactivate");
+ submitButton.disabled = false;
+ } else {
+ submitButton.classList.add("deactivate");
+ submitButton.disabled = true;
+ }
+} \ No newline at end of file
diff --git a/Static/Js/userinfo.js b/Static/Js/userinfo.js
index 29c92d0..8f1e239 100644
--- a/Static/Js/userinfo.js
+++ b/Static/Js/userinfo.js
@@ -1,7 +1,9 @@
-// ****************************************************************************
-// USERINFO
-// ****************************************************************************
+// ############################################################################
+// # #
+// # Description: JS utile sur la page user infos #
+// # #
+// ############################################################################
// Mes sources pour créer cette partie:
// https://stackoverflow.com/questions/1085801/get-selected-value-in-dropdown-list-using-javascript
// https://stackoverflow.com/questions/47951287/dynamically-add-li-to-ul-javascript
@@ -13,21 +15,17 @@
// On passe par du JSON pour passer la liste des emplois du pro
// ****************************************************************************
-// GLOBAL
-// ****************************************************************************
-var payload = [];
-
-// ****************************************************************************
-// FONCTIONS PRINCIPALES
+// GESTION AJOUT/SUPPRESSION D'UN EMPLOI ET PASSAGE A L'INPUT
+// DES VALEURS SELECTIONNEES
// ****************************************************************************
+var payload = [];
-// TODO: Revoir les commentaires
// Initiation
function init() {
// Récupération des emplois déja présent
let jobs = document.getElementsByClassName("jobsListElem");
- // Pour chaque emploi disponible
+ // Pour chaque emploi disponible récupération de sa valeur
for (i = 0; i < jobs.length; i ++) {
if (jobs[i].getAttribute("data-value") !== "") {
payload.push(jobs[i].getAttribute("data-value"));
@@ -42,28 +40,29 @@ function init() {
// Ajout d'un emploi
function add() {
- // Récupération du nom du choix dans le "select" des emplois
+ // Récupération du nom et de la valeur du choix dans le "select" des emplois
let jobName = document.getElementById("jobsSel").options[jobsSel.selectedIndex].text;
let jobValue = document.getElementById("jobsSel").options[jobsSel.selectedIndex].value;
- // Si l'emploi n'est pas deja dans "payload"
- // et si il fait bien partie du dictionnaire de tous les emplois
+ // Si l'emploi n'est pas deja dans "payload" et que sa valeur est non nul (choix par défaut)
if (!payload.includes(jobValue) && jobValue !== "") {
// Ajout à payload
payload.push(jobValue);
- // Création, configuration et ajout du nouveau "li"
+ // Création, configuration et ajout d'une nouvelle div pour l'emploi choisi
+ // Création du "i"
let i = document.createElement("i");
i.className = "fas fa-ban";
-
+ // Création, configuration de la div et ajout du "i"
let div = document.createElement("div");
div.className = "jobsListElem";
div.dataset.value = jobValue;
div.onclick = (ptrEvent) => {remove(ptrEvent)};
div.appendChild(document.createTextNode(jobName));
div.appendChild(i);
-
+ // Enfin, ajout au document
document.getElementById("jobsListGrid").appendChild(div);
+
// Transformation de la liste des emplois choisis en JSON
// et inscription de ce dernier dans la "value" de l'input "jobs".
document.getElementById("jobs").value = JSON.stringify(payload);
@@ -73,9 +72,11 @@ function add() {
function remove(ptrEvent) {
// Suppression de l'emploi dans "payload"
payload.splice(payload.indexOf(ptrEvent.srcElement.getAttribute("data-value")), 1);
+
// Suppression du "div" de l'emploi
document.getElementById("jobsListGrid").removeChild(ptrEvent.srcElement);
+
// Transformation de la liste des emplois choisis en JSON
// et inscription de ce dernier dans la "value" de l'input "jobs".
document.getElementById("jobs").value = JSON.stringify(payload);
-} \ No newline at end of file
+}
diff --git a/Template/Include/en/text.php b/Template/Include/en/text.php
index 7b8cfd1..b6f81e0 100644
--- a/Template/Include/en/text.php
+++ b/Template/Include/en/text.php
@@ -8,7 +8,7 @@
$text = [
"incl_form_admin" => [
- "btManageJob" => "Manage jobs categories",
+ "btManageJob" => "Manage job categories",
"btManageUser" => "Manage users",
"btManageMission" => "Manage missions",
"formJobAddEn" => "Name in English",
@@ -20,7 +20,7 @@ $text = [
"submitDel" => "Delete",
],
"incl_global_footer" => [
- "main" => "Made by Debulois Quentin for my professional folder.<br>December 2021, all rights reserved.",
+ "main" => "Made by Debulois Quentin for my professional folder.<br>Handmade from December 2021 to April 2022",
],
"incl_form_userInfo" => [
"h2" => "Informations about the user.",
@@ -77,14 +77,19 @@ $text = [
"btnLang" => "Select"
],
"incl_form_register" => [
- "h2" => "Form to sign-in",
- "email" => "Email",
- "password" => "Password",
- "notice" => "Admin is here for the purpose of the exam only:",
- "isAdmin" => "Is admin?",
- "isPro" => "Is pro?",
- "isClient" => "Is client?",
- "submit" => "Sign-up"
+ "h2" => "Form to sign-up",
+ "email" => "Email",
+ "password" => "Password",
+ "passNotice" => "The password must have at least:",
+ "passLength" => "8 characters,",
+ "passUpper" => "one uppercase,",
+ "passNumb" => "one number,",
+ "passSpecial" => "one special character.",
+ "notice" => "\"Admin\" is here for the purpose of the exam only:",
+ "isAdmin" => "Admin",
+ "isPro" => "Pro",
+ "isClient" => "Client",
+ "submit" => "Sign-up"
],
"incl_index_search" => [
"h2" => "Search a professional",
diff --git a/Template/Include/fr/message.php b/Template/Include/fr/message.php
index d9dc98c..ef86420 100644
--- a/Template/Include/fr/message.php
+++ b/Template/Include/fr/message.php
@@ -83,7 +83,7 @@ $messageText = [
"notConnected" => [
"success" => false,
"title" => "Requête de mission.",
- "info" => "Erreur, Vous devez être connecté, et connecté en tant que client.",
+ "info" => "Erreur, vous devez être connecté, et connecté en tant que client.",
"timer" => true,
"toSrc" => false
]
diff --git a/Template/Include/fr/text.php b/Template/Include/fr/text.php
index ed28f1f..bff6489 100644
--- a/Template/Include/fr/text.php
+++ b/Template/Include/fr/text.php
@@ -11,16 +11,16 @@ $text = [
"btManageJob" => "Gestion des emplois",
"btManageUser" => "Gestion des utilisateurs",
"btManageMission" => "Gestion des missions",
- "formJobAddEn" => "Nom en Englais",
+ "formJobAddEn" => "Nom en Anglais",
"formJobAddFr" => "Nom en Français",
"submitJobAdd" => "Ajouter",
- "selJobDel" => "Choisir une categorie à suppr.",
+ "selJobDel" => "Choisir une catégorie à suppr.",
"submitJobDel" => "Suppr.",
"formDel" => "ID à supprimer",
"submitDel" => "Supprimer",
],
"incl_global_footer" => [
- "main" => "Réalisé par Debulois Quentin pour mon dossier professionel.<br>Decembre 2021, tous droits réservés.",
+ "main" => "Réalisé par Debulois Quentin pour mon dossier professionel.<br>Réalisé 100% à la main de Decembre 2021 à Avril 2022.",
],
"incl_form_userInfo" => [
"h2" => "Informations sur l'utilisateur.",
@@ -77,14 +77,19 @@ $text = [
"btnLang" => "Sélectionner"
],
"incl_form_register" => [
- "h2" => "Formulaire d'inscription",
- "email" => "Email",
- "password" => "Mot de passe",
- "notice" => "Admin est présent pour les besoins de l'examen uniquement:",
- "isClient" => "Est client?",
- "isPro" => "Est pro?",
- "isAdmin" => "Est admin?",
- "submit" => "S'inscrire"
+ "h2" => "Formulaire d'inscription",
+ "email" => "Email",
+ "password" => "Mot de passe",
+ "passNotice" => "Le mot de passe doit au moins avoir:",
+ "passLength" => "8 caractères,",
+ "passUpper" => "une majuscule,",
+ "passNumb" => "un chiffre,",
+ "passSpecial" => "un caractère spécial.",
+ "notice" => "\"Admin\" est présent pour les besoins de l'examen uniquement:",
+ "isClient" => "Client",
+ "isPro" => "Pro",
+ "isAdmin" => "Admin",
+ "submit" => "S'inscrire"
],
"incl_index_search" => [
"h2" => "Rechercher un professionnel",
diff --git a/Template/Include/incl_form_register.php b/Template/Include/incl_form_register.php
index 0baeaf2..109c360 100644
--- a/Template/Include/incl_form_register.php
+++ b/Template/Include/incl_form_register.php
@@ -17,19 +17,32 @@ echo('<!-- Division principale -->
<h2>'.$text[basename(__FILE__, ".php")]["h2"].'</h2>
<!-- Formulaire d\'inscription -->
<form action="/../Core/wrapper.php" method="post">
- <label>
- <i class="fas fa-envelope-square"></i>
- <input type="email" name="email" id="email" maxlength="128" placeholder="'.$text[basename(__FILE__, ".php")]["email"].'" maxlength="128" required>
- </label>
- <label>
- <i class="fas fa-lock"></i>
- <input type="password" name="password" id="password" maxlength="128" placeholder="'.$text[basename(__FILE__, ".php")]["password"].'" maxlength="128" required>
- </label>
- <label class="info">'.$text[basename(__FILE__, ".php")]["notice"].'</label>
- <label for="isAdmin"><input type="radio" id="isAdmin" name="userStatus" value="0">'.$text[basename(__FILE__, ".php")]["isAdmin"].'</label>
- <label for="isPro"><input type="radio" id="isPro" name="userStatus" value="1">'.$text[basename(__FILE__, ".php")]["isPro"].'</label>
- <label for="isClient"><input type="radio" id="isClient" name="userStatus" value="2">'.$text[basename(__FILE__, ".php")]["isClient"].'</label>
- <input type="submit" value="'.$text[basename(__FILE__, ".php")]["submit"].'">
+ <div>
+ <label>
+ <i class="fas fa-envelope-square"></i>
+ <input type="email" name="email" id="email" maxlength="128" placeholder="'.$text[basename(__FILE__, ".php")]["email"].'" maxlength="128" required>
+ </label>
+ <label>
+ <i class="fas fa-lock"></i>
+ <input type="password" name="password" id="password" maxlength="128" onkeyup="check_pass()" placeholder="'.$text[basename(__FILE__, ".php")]["password"].'" maxlength="128" required>
+ </label>
+ <p>
+ '.$text[basename(__FILE__, ".php")]["passNotice"].'
+ <br>
+ <span id="passLength" class="invalid">'.$text[basename(__FILE__, ".php")]["passLength"].'</span>
+ <span id="passUpper" class="invalid">'.$text[basename(__FILE__, ".php")]["passUpper"].'</span>
+ <span id="passNumb" class="invalid">'.$text[basename(__FILE__, ".php")]["passNumb"].'</span>
+ <span id="passSpecial" class="invalid">'.$text[basename(__FILE__, ".php")]["passSpecial"].'</span>
+ </p>
+ </div>
+ <h3>User role</h3>
+ <div>
+ <label class="info">'.$text[basename(__FILE__, ".php")]["notice"].'</label>
+ <label for="isAdmin"><input type="radio" id="isAdmin" name="userStatus" value="0">'.$text[basename(__FILE__, ".php")]["isAdmin"].'</label>
+ <label for="isPro"><input type="radio" id="isPro" name="userStatus" value="1">'.$text[basename(__FILE__, ".php")]["isPro"].'</label>
+ <label for="isClient"><input type="radio" id="isClient" name="userStatus" value="2">'.$text[basename(__FILE__, ".php")]["isClient"].'</label>
+ <input id="submit" type="submit" class="deactivate" value="'.$text[basename(__FILE__, ".php")]["submit"].'">
+ </div>
</form>
</main>'.PHP_EOL);
diff --git a/Template/Include/incl_global_navbar.php b/Template/Include/incl_global_navbar.php
index 95ab8d8..cfb795f 100644
--- a/Template/Include/incl_global_navbar.php
+++ b/Template/Include/incl_global_navbar.php
@@ -45,10 +45,10 @@ echo(' <!-- Choix de la langue -->
// Affichage du navbar et de ses elements en fonction de si l'utilisateur est connecté ou non.
echo('<!-- navbar -->
-<nav>
-<!-- Espace vide -->
-<div class="spacer"></div>
-<!-- Liste de lien pour la navigation -->');
+ <nav>
+ <!-- Espace vide -->
+ <div class="spacer"></div>
+ <!-- Liste de lien pour la navigation -->'.PHP_EOL);
if (isset($_SESSION["loggedIn"], $_SESSION["userStatus"])
&& $_SESSION["loggedIn"] == "1"
) {
@@ -56,34 +56,36 @@ if (isset($_SESSION["loggedIn"], $_SESSION["userStatus"])
case 0:
$status = 'Admin';
echo(' <p><span class="headerInfoAdmin">'.$status.'</span>'.$_SESSION["email"].'</p>'.PHP_EOL);
- echo(' <a href="/index.php#separator2"><i class="fas fa-search"></i> '.$text[basename(__FILE__, ".php")]["btnSearch"].'</a>');
+ echo(' <a href="/index.php#separator2"><i class="fas fa-search"></i> '.$text[basename(__FILE__, ".php")]["btnSearch"].'</a>'.PHP_EOL);
echo(' <a href="/Template/admin.php"><i class="fas fa-cog"></i> '.$text[basename(__FILE__, ".php")]["btnAdmin"].'</a>'.PHP_EOL);
echo(' <a href="/Template/logout.php"><i class="fas fa-sign-out-alt"></i> '.$text[basename(__FILE__, ".php")]["btnLogout"].'</a>'.PHP_EOL);
break;
case 1:
$status = 'Pro';
echo(' <p><span class="headerInfoPro">'.$status.'</span>'.$_SESSION["email"].'</p>'.PHP_EOL);
- echo(' <a href="/index.php#separator2"><i class="fas fa-search"></i> '.$text[basename(__FILE__, ".php")]["btnSearch"].'</a>');
+ echo(' <a href="/index.php#separator2"><i class="fas fa-search"></i> '.$text[basename(__FILE__, ".php")]["btnSearch"].'</a>'.PHP_EOL);
echo(' <a href="/Template/myMission.php"><i class="fas fa-tasks"></i> '.$text[basename(__FILE__, ".php")]["btnMyMission"].'</a>'.PHP_EOL);
- echo(' <a href="/Template/userInfo.php"><i class="fas fa-user"></i> '.$text[basename(__FILE__, ".php")]["btnInfos"].'</a>');
+ echo(' <a href="/Template/userInfo.php"><i class="fas fa-user"></i> '.$text[basename(__FILE__, ".php")]["btnInfos"].'</a>'.PHP_EOL);
echo(' <a href="/Template/logout.php"><i class="fas fa-sign-out-alt"></i> '.$text[basename(__FILE__, ".php")]["btnLogout"].'</a>'.PHP_EOL);
break;
case 2:
$status = 'Client';
echo(' <p><span class="headerInfoClient">'.$status.'</span>'.$_SESSION["email"].'</p>'.PHP_EOL);
- echo(' <a href="/index.php#separator2"><i class="fas fa-search"></i> '.$text[basename(__FILE__, ".php")]["btnSearch"].'</a>');
+ echo(' <a href="/index.php#separator2"><i class="fas fa-search"></i> '.$text[basename(__FILE__, ".php")]["btnSearch"].'</a>'.PHP_EOL);
echo(' <a href="/Template/myMission.php"><i class="fas fa-tasks"></i> '.$text[basename(__FILE__, ".php")]["btnMyMission"].'</a>'.PHP_EOL);
- echo(' <a href="/Template/userInfo.php"><i class="fas fa-user"></i> '.$text[basename(__FILE__, ".php")]["btnInfos"].'</a>');
+ echo(' <a href="/Template/userInfo.php"><i class="fas fa-user"></i> '.$text[basename(__FILE__, ".php")]["btnInfos"].'</a>'.PHP_EOL);
echo(' <a href="/Template/logout.php"><i class="fas fa-sign-out-alt"></i> '.$text[basename(__FILE__, ".php")]["btnLogout"].'</a>'.PHP_EOL);
break;
}
echo(' <!-- Espace vide -->
- <div class="spacer"></div>');
+ <div class="spacer"></div>
+ </nav>'.PHP_EOL);
} else {
echo(' <a href="/Template/login.php"><i class="fas fa-sign-in-alt"></i> '.$text[basename(__FILE__, ".php")]["btnLogin"].'</a>
<a href="/Template/register.php"><i class="fas fa-user-plus"></i> '.$text[basename(__FILE__, ".php")]["btnRegister"].'</a>
<!-- Espace vide -->
- <div class="spacer"></div>'.PHP_EOL);
+ <div class="spacer"></div>
+ </nav>'.PHP_EOL);
}
-echo('</nav>');
+
?> \ No newline at end of file
diff --git a/Template/Include/incl_index_search.php b/Template/Include/incl_index_search.php
index 13d581e..f285c2e 100644
--- a/Template/Include/incl_index_search.php
+++ b/Template/Include/incl_index_search.php
@@ -18,7 +18,7 @@ $dbsearch = new DbSearch;
// SEPARATEUR
// ****************************************************************************
echo('<!-- Separateur -->
-<div id="separator2" class="separator"></div>');
+<div id="separator2" class="separator"></div>'.PHP_EOL);
// ****************************************************************************
// DIV PRINCIPALE
@@ -26,7 +26,7 @@ echo('<!-- Separateur -->
echo('<!-- Division principale -->
<main id="mainSearch">'.PHP_EOL);
-// Form pour la recherche par nom et envoi au wrappeur.
+// Form pour la recherche par nom ou type d'emploi et envoi au wrappeur.
echo('<!-- Form de recherche -->
<h2>'.$text[basename(__FILE__, ".php")]["h2"].'</h2>
<div id="divSearch">
@@ -123,8 +123,8 @@ if (isset($_SESSION["search"])) {
</td>
</tr>');
}
- echo('</tbody>');
- echo('</table>');
+ echo('</tbody>
+ </table>');
} else {
echo('<p>'.$text[basename(__FILE__, ".php")]["noResult"].'</p>');
}
@@ -191,8 +191,7 @@ if (isset($_SESSION["search"])) {
<form id="formMandate" action="/Core/wrapper.php" method="post">
<input type="hidden" name="mandateProId" value="'.$_SESSION["search"]["result"][0]["userId"].'">
<input type="submit" value="'.$text[basename(__FILE__, ".php")]["mandate"].'">
- </form>
- </table>');
+ </form>');
}
}
diff --git a/Template/Include/incl_table_myMission.php b/Template/Include/incl_table_myMission.php
index 504abac..d97e32d 100644
--- a/Template/Include/incl_table_myMission.php
+++ b/Template/Include/incl_table_myMission.php
@@ -74,9 +74,9 @@ echo('<div id="myMissionButtons">
// ****************************************************************************
// TABLEAU DES MISSIONS EN ATTENTE
// ****************************************************************************
+echo('<section id="secCompleted">');
if ($missionStatus["pending"]) {
- echo('<section id="secPending">
- <table>
+ echo(' <table>
<!-- En-tête -->
<tr>'.PHP_EOL);
foreach($header["pendingMissions"] as $columnHeader) {
@@ -100,20 +100,18 @@ if ($missionStatus["pending"]) {
}
echo(' </tr>'.PHP_EOL);
}
- echo(' </table>
- </section>');
+ echo(' </table>');
} else {
- echo('<section id="secPending">
- <p>'.$text[basename(__FILE__, ".php")]["noPending"].'</p>
- </section>');
+ echo('<p>'.$text[basename(__FILE__, ".php")]["noPending"].'</p>');
}
+echo('</section>');
// ****************************************************************************
// TABLEAU DES MISSIONS EN COURS
// ****************************************************************************
+echo('<section id="secCompleted">');
if ($missionStatus["ongoing"]) {
- echo('<section id="secOngoing">
- <table>
+ echo(' <table>
<!-- En-tête -->
<tr>'.PHP_EOL);
foreach($header["ongoingMissions"] as $columnHeader) {
@@ -141,20 +139,18 @@ if ($missionStatus["ongoing"]) {
}
echo(' </tr>'.PHP_EOL);
}
- echo(' </table>
- </section>');
+ echo(' </table>');
} else {
- echo('<section id="secOngoing">
- <p>'.$text[basename(__FILE__, ".php")]["noOngoing"].'</p>
- </section>');
+ echo('<p>'.$text[basename(__FILE__, ".php")]["noOngoing"].'</p>');
}
+echo('</section>');
// ****************************************************************************
// TABLEAU DES MISSIONS TERMINEES
// ****************************************************************************
+echo('<section id="secCompleted">');
if ($missionStatus["completed"]) {
- echo('<section id="secCompleted">
- <table>
+ echo(' <table>
<!-- En-tête -->
<tr>'.PHP_EOL);
foreach($header["completedMissions"] as $columnHeader) {
@@ -183,14 +179,15 @@ if ($missionStatus["completed"]) {
}
echo('</tr>'.PHP_EOL);
}
- echo(' </table>
- </section>');
+ echo(' </table>');
} else {
- echo('<section id="secCompleted">
- <p>'.$text[basename(__FILE__, ".php")]["noCompleted"].'</p>
- </section>');
+ echo('<p>'.$text[basename(__FILE__, ".php")]["noCompleted"].'</p>');
}
+echo('</section>');
+// ****************************************************************************
+// DIV SPACER
+// ****************************************************************************
echo('<!-- Espace vide si le tableau est petit -->
<div class="spacer"></div>');
diff --git a/Template/register.php b/Template/register.php
index 9e64b4b..9c5b84f 100644
--- a/Template/register.php
+++ b/Template/register.php
@@ -33,5 +33,6 @@ $_SESSION["src"] = basename(__FILE__, ".php");
<?php require_once(dirname( __FILE__ )."./Include/incl_form_register.php")?>
<?php require_once(dirname( __FILE__ )."./Include/incl_global_footer.php");?>
<script src="/Static/Js/main.js"></script>
+ <script src="/Static/Js/register.js"></script>
</body>
</html> \ No newline at end of file