Skip to content
Snippets Groups Projects
Commit e3f35dfe authored by Boris's avatar Boris
Browse files

Page de bienvenue - seule page accessible directement par navigater : login - ...

Page de bienvenue - seule page accessible directement par navigater : login -  ajout de ftl pour l'utilisateur regulier et pour le mod(suppression de profs en plus)
parent 7783168a
No related branches found
No related tags found
No related merge requests found
Showing
with 49 additions and 4 deletions
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<label for="userName">Nom d'utilisateur</label> <label for="userName">Nom d'utilisateur</label>
<input name="userName"> <input name="userName">
<label for="password">Mot de passe</label> <label for="password">Mot de passe</label>
<input name="password"> <input name="password" type="password">
<button type="submit" placeholder="Supprimer...">Envoyer</button> <button type="submit" placeholder="Supprimer...">Envoyer</button>
</form> </form>
......
<#ftl encoding="utf-8">
<body xmlns="http://www.w3.org/1999/html">
<ul>
<h1> Liste des enseignants: </h1>
<#list profs as prof>
<li>${prof.id} - ${prof.firstName} ${prof.lastName} aka ${prof.userName} </li>
</#list>
</ul>
<a href="/welcome">Retour à la page d'accueil</a>
</body>
</html>
<#ftl encoding="utf-8">
<body xmlns="http://www.w3.org/1999/html">
<h1>Bienvenue ${prof.userName}</h1>
<a href="/profs" >Consulter la liste des profs</a>
</body>
</html>
No preview for this file type
...@@ -13,6 +13,7 @@ public class StartServer { ...@@ -13,6 +13,7 @@ public class StartServer {
//.\gradlew run //.\gradlew run
public static boolean authentified = false; public static boolean authentified = false;
public static ProfEntity connected = null;
public static void displayLocalHost(int portNb, String suffix) public static void displayLocalHost(int portNb, String suffix)
{ {
...@@ -49,6 +50,18 @@ public class StartServer { ...@@ -49,6 +50,18 @@ public class StartServer {
}); });
get("/welcome",(req,res) -> {
if (authentified)
{
return ProfGUI.getWelcomePage(connected);
}
else
{
res.redirect("/login");
return null;
}
});
post("/profs/delete",(req,res) -> { post("/profs/delete",(req,res) -> {
ProfGUI.delete(req.queryParams("id")); ProfGUI.delete(req.queryParams("id"));
res.redirect("/profs"); res.redirect("/profs");
...@@ -75,13 +88,14 @@ public class StartServer { ...@@ -75,13 +88,14 @@ public class StartServer {
if (found != null) { if (found != null) {
if (found.getPassword().compareTo(password) == 0) { if (found.getPassword().compareTo(password) == 0) {
authentified = true; authentified = true;
res.redirect("/profs"); connected = found;
res.redirect("/welcome");
System.out.println(found); System.out.println(found);
return null; return null;
} }
} }
return "<!DOCTYPE html><html>Incorrect</html>"; return "<!DOCTYPE html><html>Incorrect<a href=\'/login\'>Reessayer</a></html>";
}); });
} }
......
...@@ -51,7 +51,7 @@ public class _Initializer { ...@@ -51,7 +51,7 @@ public class _Initializer {
Core.User.create("Terry", "Golo"); Core.User.create("Terry", "Golo");
Core.User.create("Judas", "Nanas"); Core.User.create("Judas", "Nanas");
Core.Prof.create("Boris", "OUYA", "DaWarudo",""); Core.Prof.create("Boris", "OUYA", "DaWarudo","KonoDioDa!");
Core.Prof.create("Thomas", "TAMAGNAUD", "CéMoiLul","FaisMoiMal"); Core.Prof.create("Thomas", "TAMAGNAUD", "CéMoiLul","FaisMoiMal");
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment