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

Logout

parent 45165d1e
No related branches found
No related tags found
No related merge requests found
......@@ -40,6 +40,8 @@ public class StartServer {
{
System.out.println("http://localhost:"+portNb+"/"+suffix);
}
public static void main(String[] args) throws Exception{
int portNb = 8081;
......@@ -92,6 +94,13 @@ public class StartServer {
return null;
});
post("/logout", (req,res) -> {
res.removeCookie("session-id");
res.redirect("/login");
return null;
});
displayLocalHost(portNb, "login");
get("/login",(req,res)->{
......@@ -113,7 +122,6 @@ public class StartServer {
res.cookie("session-id",id);
res.redirect("/welcome");
return null;
}
return "<!DOCTYPE html><html>Incorrect<a href=\'/login\'>Reessayer</a></html>";
......
......@@ -12,6 +12,12 @@
<a href="/eleves" >Liste des eleves</a>
<a href="/gommettes">Liste des gommettes</a>
<form method="post" action="/logout">
<input type="hidden" name="id" value="${prof.id}">
<button type="submit">Se déconnecter</button>
</form>
</body>
</html>
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