summaryrefslogtreecommitdiff
path: root/src/main/resources/templates
diff options
context:
space:
mode:
authorPaul-Christian Volkmer2024-01-11 13:09:55 +0100
committerPaul-Christian Volkmer2024-01-11 13:29:33 +0100
commit8a11e6e85b2b2cb4f860ddca010386cb3f701f9b (patch)
treee5e21d21cba3f6d5845b185bce26a5d80e126b42 /src/main/resources/templates
parent5579ad14534111db6954b772ccd0ea72a09e4c15 (diff)
feat #18: initial support for authentication
Diffstat (limited to 'src/main/resources/templates')
-rw-r--r--src/main/resources/templates/fragments.html12
-rw-r--r--src/main/resources/templates/index.html5
-rw-r--r--src/main/resources/templates/login.html23
-rw-r--r--src/main/resources/templates/report.html5
4 files changed, 39 insertions, 6 deletions
diff --git a/src/main/resources/templates/fragments.html b/src/main/resources/templates/fragments.html
index 677e841..7a9af2f 100644
--- a/src/main/resources/templates/fragments.html
+++ b/src/main/resources/templates/fragments.html
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<html xmlns:th="http://www.thymeleaf.org">
+<html xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" th:href="@{/style.css}" />
@@ -14,7 +14,15 @@
<ul>
<li><a th:href="@{/}">Übersicht</a></li>
<li><a th:href="@{/statistics}">Statistiken</a></li>
- <li><a th:href="@{/configs}">Konfiguration</a></li>
+ <li sec:authorize="hasRole('ADMIN')">
+ <a th:href="@{/configs}">Konfiguration</a>
+ </li>
+ <li class="login" sec:authorize="not isAuthenticated()">
+ <a th:href="@{/login}">Login</a>
+ </li>
+ <li class="login" sec:authorize="isAuthenticated()">
+ <a th:href="@{/logout}">Abmelden</a>
+ </li>
</ul>
</nav>
</div>
diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html
index b34804b..b1c3142 100644
--- a/src/main/resources/templates/index.html
+++ b/src/main/resources/templates/index.html
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<html lang="de" xmlns:th="http://www.thymeleaf.org">
+<html lang="de" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>ETL-Prozessor</title>
@@ -42,7 +42,8 @@
<a th:href="@{/report/{id}(id=${request.uuid})}">[[ ${request.uuid} ]]</a>
</td>
<td><time th:datetime="${request.processedAt}">[[ ${request.processedAt} ]]</time></td>
- <td>[[ ${request.patientId} ]]</td>
+ <td class="patient-id" sec:authorize="authenticated">[[ ${request.patientId} ]]</td>
+ <td class="patient-id" sec:authorize="not authenticated">***</td>
</tr>
</tbody>
</table>
diff --git a/src/main/resources/templates/login.html b/src/main/resources/templates/login.html
new file mode 100644
index 0000000..018122d
--- /dev/null
+++ b/src/main/resources/templates/login.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html lang="de" xmlns:th="http://www.thymeleaf.org">
+<head>
+ <meta charset="UTF-8">
+ <title>ETL-Prozessor</title>
+ <link rel="stylesheet" th:href="@{/style.css}" />
+</head>
+<body>
+ <div th:replace="~{fragments.html :: nav}"></div>
+ <main>
+ <div class="login-form">
+ <h2 class="centered">Anmelden</h2>
+ <div class="centered notification error" th:if="${param.error}">Anmeldung nicht erfolgreich</div>
+ <div class="centered notification success" th:if="${param.logout}">Sie haben sich abgemeldet</div>
+ <form method="post" th:action="@{/login}">
+ <input type="text" id="username" name="username" class="form-control" placeholder="Username" required="" autofocus="">
+ <input type="password" id="password" name="password" class="form-control" placeholder="Password" required="">
+ <button class="" type="submit">Anmelden</button>
+ </form>
+ </div>
+ </main>
+</body>
+</html> \ No newline at end of file
diff --git a/src/main/resources/templates/report.html b/src/main/resources/templates/report.html
index 01accc4..6f89345 100644
--- a/src/main/resources/templates/report.html
+++ b/src/main/resources/templates/report.html
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<html lang="de" xmlns:th="http://www.thymeleaf.org">
+<html lang="de" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>ETL-Prozessor</title>
@@ -31,7 +31,8 @@
<td th:style="${request.type.value == 'delete'} ? 'color: red;'"><small>[[ ${request.type} ]]</small></td>
<td>[[ ${request.uuid} ]]</td>
<td><time th:datetime="${request.processedAt}">[[ ${request.processedAt} ]]</time></td>
- <td>[[ ${request.patientId} ]]</td>
+ <td class="patient-id" sec:authorize="authenticated">[[ ${request.patientId} ]]</td>
+ <td class="patient-id" sec:authorize="not authenticated">***</td>
</tr>
</tbody>
</table>