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 5127db7b293abc21f584a3923b97788a5e3c1650..a803add34a07f4a1f4bbeae807631a1f6c5253ec 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 212601a3ca9479dd04fd24703388ae012bd868b3..10b5cb6c372d0e81771dd6d11e25ccf5a42ac018 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 7693f8f1579db2a27c3a65f04259add3c0148dce..113a345e4cbce7ddc32aedd202947cc6d9cc449b 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