Update so there is an open landing page and a login page

- make / public
- add login on index.html
- add UserAttribute
- add hasRole to RemoteAuthentication
- update HomeController to give welcome instead of index if login.
- add welcome.html
This commit is contained in:
2025-01-20 21:43:36 +01:00
parent 9f6d7066b7
commit 3212226853
6 changed files with 76 additions and 2 deletions

View File

@@ -9,6 +9,7 @@
<h1>Test</h1>
<hr>
<p>This is a index page!</p>
<a href="/login">login</a>
</main>
<!--/*/<th:block th:replace="~{layout.html :: script}"/>/*/-->
</body>

View File

@@ -0,0 +1,23 @@
<!DOCTYPE HTML>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<title>Home Pages</title>
<!--/*/<th:block th:insert="~{layout.html :: documentHead}"/>/*/-->
</head>
<body>
<main>
<h1>Welcome</h1>
<hr>
<!--/*@thymesVar id="remoteUser" type="ltd.hlaeja.security.RemoteAuthentication"*/-->
<div th:if="${remoteUser.hasRole('admin')}">
You are an admin!
</div>
<div th:if="${remoteUser.hasRole('user')}">
You are a user!
</div>
<p>This is welcome pages and you're a user!</p>
<a href="/logout">Logout</a>
</main>
<!--/*/<th:block th:replace="~{layout.html :: script}"/>/*/-->
</body>
</html>