Added basic login and logout functionality
- update SecurityConfiguration - add logout - add login - add AuthenticationController - add goodbye.html - add logout.html - add login.html
This commit is contained in:
16
src/main/resources/templates/authentication/goodbye.html
Normal file
16
src/main/resources/templates/authentication/goodbye.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<title>Goodbye</title>
|
||||
<!--/*/<th:block th:insert="~{layout.html :: documentHead}"/>/*/-->
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<h1>You are logged out</h1>
|
||||
<hr>
|
||||
<p>We hope to see you again soon!</p>
|
||||
<a th:href="@{/login}">Login Again</a>
|
||||
</main>
|
||||
<!--/*/<th:block th:replace="~{layout.html :: script}"/>/*/-->
|
||||
</body>
|
||||
</html>
|
||||
23
src/main/resources/templates/authentication/login.html
Normal file
23
src/main/resources/templates/authentication/login.html
Normal file
@@ -0,0 +1,23 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<title>Login</title>
|
||||
<!--/*/<th:block th:insert="~{layout.html :: documentHead}"/>/*/-->
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<h1>Login</h1>
|
||||
<hr>
|
||||
<form id="loginForm" th:action="@{/login}" th:method="post">
|
||||
<label for="username" >Username</label>
|
||||
<input type="text" id="username" name="username" placeholder="Enter your username" required>
|
||||
<br>
|
||||
<label for="password">Password</label>
|
||||
<input type="password" id="password" name="password" placeholder="Enter your password" required>
|
||||
<br>
|
||||
<button type="submit">Login</button>
|
||||
</form>
|
||||
</main>
|
||||
<!--/*/<th:block th:replace="~{layout.html :: script}"/>/*/-->
|
||||
</body>
|
||||
</html>
|
||||
17
src/main/resources/templates/authentication/logout.html
Normal file
17
src/main/resources/templates/authentication/logout.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<title>Logout</title>
|
||||
<!--/*/<th:block th:insert="~{layout.html :: documentHead}"/>/*/-->
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<h1>Logout</h1>
|
||||
<hr>
|
||||
<p>Are you sure you want to logout?</p>
|
||||
<form id="logoutForm" th:action="@{/logout}" th:method="post"></form>
|
||||
<button type="submit" onclick="document.getElementById('logoutForm').submit(); return false;">Logout</button>
|
||||
</main>
|
||||
<!--/*/<th:block th:replace="~{layout.html :: script}"/>/*/-->
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user