Added Login

This commit is contained in:
2025-02-17 03:38:48 +01:00
parent af5248faed
commit 90ccb8a00c
20 changed files with 519 additions and 20 deletions
+45
View File
@@ -0,0 +1,45 @@
<!DOCTYPE html>
<html lang="fr" dir="ltr">
<head>
<div th:replace="~{html-head}"/>
</head>
<body>
<div th:replace="~{header}"/>
<main>
<div th:if="${param.success}">
You have successfully registered our app!
</div>
<form
method="post"
role="form"
th:action="@{/adduser/save}"
th:object="${user}"
>
<label for="name">Name</label>
<input
id="name"
name="name"
placeholder="Enter pseudo"
th:field="*{name}"
type="text"
/>
<p th:errors = "*{name}" th:if="${#fields.hasErrors('name')}"></p>
<label for="password">Password</label>
<input
id="password"
name="password"
placeholder="Enter password"
th:field="*{password}"
type="password"
/>
<p th:errors = "*{password}" class="text-danger"
th:if="${#fields.hasErrors('password')}"></p>
<button class="btn btn-primary" type="submit">Register</button>
</form>
</main>
</body>
</html>
+1 -1
View File
@@ -4,7 +4,7 @@
<ul class="menu">
<li><a href="/questions/quizz">Quizz</a></li>
<li><a href="/questions/forms">Forms</a></li>
<li><a href="/questions/login">Login</a></li>
<li><a href="/login">Login</a></li>
</ul>
</div>
</nav>
+13
View File
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="fr" dir="ltr">
<head>
<div th:replace="~{html-head}"/>
</head>
<body>
<div th:replace="~{header}"/>
<main>
Logged in as <div th:text="${username}"></div>
</main>
</body>
</html>
+16 -6
View File
@@ -8,14 +8,24 @@
<div th:replace="~{header}"/>
<main>
<form>
<label for="login-pseudo">Pseudo :</label>
<input type="text" id="login-pseudo" name="pseudo"/>
<div th:if="${param.error}">
<div class="alert alert-danger">Invalid Email or Password</div><br/>
</div>
<div th:if="${param.logout}">
<div class="alert alert-success"> You have been logged out.</div><br/>
</div>
<form
method="post"
role="form"
th:action="@{/login}">
<label for="username">Pseudo :</label>
<input type="text" id="username" name="username"/>
<br/>
<label for="login-password">Mot de passe :</label>
<input type="text" id="login-password" name="password"/>
<label for="password">Mot de passe :</label>
<input type="password" id="password" name="password"/>
<br/>
<input id="connect" type="button">Se connecter</input>
<input id="connect" type="submit">Se connecter</input>
</form>
</main>
</body>