aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Harrington <kb0iic@berzerkula.org>2025-02-18 10:09:04 -0600
committerWilliam Harrington <kb0iic@berzerkula.org>2025-02-18 10:09:04 -0600
commit75ede4b9db80823e5fba3316a31a57ce32099d64 (patch)
tree30b2f88e0caa1c79be8b4f70ca33f513a3db5840
parentc86404d612561797e2328a1388e0fc9c709bcf3e (diff)
After successful registration, redirect to login with a registrationSuccess parameter with success alert.
-rw-r--r--src/main/java/org/berzerkula/builddb/controllers/AccountController.java4
-rw-r--r--src/main/resources/templates/login.html10
-rw-r--r--src/main/resources/templates/register.html9
3 files changed, 9 insertions, 14 deletions
diff --git a/src/main/java/org/berzerkula/builddb/controllers/AccountController.java b/src/main/java/org/berzerkula/builddb/controllers/AccountController.java
index bfaf669..896f586 100644
--- a/src/main/java/org/berzerkula/builddb/controllers/AccountController.java
+++ b/src/main/java/org/berzerkula/builddb/controllers/AccountController.java
@@ -101,8 +101,8 @@ public class AccountController {
, ex.getMessage())
);
}
-
- return BuilddbConstants.VIEW_REGISTER;
+
+ return "redirect:/login?registerSuccess";
}
}
diff --git a/src/main/resources/templates/login.html b/src/main/resources/templates/login.html
index 0893fa0..1bb2185 100644
--- a/src/main/resources/templates/login.html
+++ b/src/main/resources/templates/login.html
@@ -14,7 +14,6 @@
<h2 class="text-center mb-4">Login</h2>
<hr />
-
<div th:if="${param.error}"
class="alert alert-danger alert-dismissible fade show" role="alert">
@@ -23,11 +22,17 @@
aria-label="Close"></button>
</div>
+ <div th:if="${param.registerSuccess}"
+ class="alert alert-success alert-dismissible fade show" role="alert">
+ <strong>Account Created Successfully!</strong>
+ <button type="button" class="btn-close" data-bs-dismiss="alert"
+ aria-label="Close"></button>
+ </div>
+
<form method="post">
<input type="hidden" th:name="${_csrf.parameterName}"
th:value="${_csrf.token}" />
-
<div class="mb-3">
<label class="form-label">Email</label>
<input class="form-control" name="email" />
@@ -50,7 +55,6 @@
</div>
</div>
-
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
</body>
</html>
diff --git a/src/main/resources/templates/register.html b/src/main/resources/templates/register.html
index 41175d5..230bbeb 100644
--- a/src/main/resources/templates/register.html
+++ b/src/main/resources/templates/register.html
@@ -14,15 +14,6 @@
<h2 class="text-center mb-4">Register</h2>
<hr />
- <div th:if="${success}"
- class="alert alert-success alert-dismissible fade show" role="alert">
-
- <strong>Account Created Successfully!</strong>
- <a class="ms-2" href="/login">Login</a>
- <button type="button" class="btn-close" data-bs-dismiss="alert"
- aria-label="Close"></button>
- </div>
-
<form method="post" th:object="${registerDto}">
<input type="hidden" th:name="${_csrf.parameterName}"
th:value="${_csrf.token}" />