From aaac481a842cdd91e892ce22bcfbbca483c3397c Mon Sep 17 00:00:00 2001
From: Charlie Darques <charlie.darques.etu@univ-lille.fr>
Date: Fri, 28 Feb 2025 15:51:03 +0100
Subject: [PATCH] modif pages de connexion/inscription

---
 WEB-INF/src/controleurs/{SignIn.java => SignUp.java} | 6 +++---
 create.html                                          | 7 ++++---
 index.html                                           | 9 +++++----
 3 files changed, 12 insertions(+), 10 deletions(-)
 rename WEB-INF/src/controleurs/{SignIn.java => SignUp.java} (82%)

diff --git a/WEB-INF/src/controleurs/SignIn.java b/WEB-INF/src/controleurs/SignUp.java
similarity index 82%
rename from WEB-INF/src/controleurs/SignIn.java
rename to WEB-INF/src/controleurs/SignUp.java
index 5127db7..a803add 100644
--- a/WEB-INF/src/controleurs/SignIn.java
+++ b/WEB-INF/src/controleurs/SignUp.java
@@ -10,13 +10,13 @@ import jakarta.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.io.PrintWriter;
 
-@WebServlet("/SignIn")
-public class SignIn extends HttpServlet {
+@WebServlet("/SignUp")
+public class SignUp extends HttpServlet {
     @Override
     public void service(HttpServletRequest req, HttpServletResponse res) throws IOException {
         PrintWriter out = res.getWriter();
         UserDAO userdao = new UserDAO();
-        userdao.createUser(); //WIP
+        User user = new User(req.getParameter("login"), req.getParameter("pwd"));
 
         if (userdao.isDatabased(user)){
             out.println("<h1>Bienvenue " + user.getUserName() + " !</h1>");
diff --git a/create.html b/create.html
index 212601a..10b5cb6 100644
--- a/create.html
+++ b/create.html
@@ -5,9 +5,10 @@
     <title>Create Account</title>
 </head>
 <body>
-<form action="LogIn">
-    <input name="login" type="text">
-    <input name="pwd" type="password">
+    <h1>Sign up</h1>
+<form action="http://localhost:8080/s4a021-web-backend/SignUp" method="post">
+    <input name="login" type="text" placeholder="username">
+    <input name="pwd" type="password" placeholder="password">
     <button type="submit">Create my Account</button>
 </form>
 </body>
diff --git a/index.html b/index.html
index 7693f8f..113a345 100644
--- a/index.html
+++ b/index.html
@@ -8,11 +8,12 @@
     <title>Connexion</title>
 </head>
 <body>
-<form action="LogIn" method="get">
-    <input name="login" type="text">
-    <input name="pwd" type="password">
+    <h1>Connexion</h1>
+<form action="http://localhost:8080/s4a021-web-backend/LogIn" method="post">
+    <input name="login" type="text" placeholder="username">
+    <input name="pwd" type="password" placeholder="password">
     <button type="submit">Connexion</button>
-    <a href="./create.html">Create Account</a>
+    <p><i>New user ? Click <a href="./create.html">here</a> to create an account</i></p>
 </form>
 </body>
 </html>
\ No newline at end of file
-- 
GitLab