Gitlab@Informatics

Skip to content
Snippets Groups Projects
Commit ac6b8bbe authored by 65160381's avatar 65160381
Browse files

Update file register.ejs

parent 1a6ad801
Branches
No related tags found
No related merge requests found
Pipeline #545 passed with warnings
...@@ -41,6 +41,13 @@ ...@@ -41,6 +41,13 @@
<form action="/user/register" method="POST"> <form action="/user/register" method="POST">
<h1 class="h3 mb-3 fw-normal">Sign up</h1> <h1 class="h3 mb-3 fw-normal">Sign up</h1>
<!-- Show error message if any -->
<% if (message && message.length > 0) { %>
<div class="alert alert-danger" role="alert">
<%= message %>
</div>
<% } %>
<div class="form-floating"> <div class="form-floating">
<label for="floatingUsername">Username</label> <label for="floatingUsername">Username</label>
<input type="text" class="form-control" id="floatingUsername" name="username" placeholder="Username" required> <input type="text" class="form-control" id="floatingUsername" name="username" placeholder="Username" required>
...@@ -72,12 +79,25 @@ ...@@ -72,12 +79,25 @@
</div> </div>
<button class="btn btn-primary w-100 py-2" type="submit">Sign up</button> <button class="btn btn-primary w-100 py-2" type="submit">Sign up</button>
</form> </form>
</main> </main>
<script src="/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script> <script src="/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
<script>
// Optional: JavaScript to check if passwords match before form submission
const form = document.querySelector('form');
form.addEventListener('submit', function(e) {
const password = document.getElementById('floatingPassword').value;
const confirmPassword = document.getElementById('floatingConfirmPassword').value;
if (password !== confirmPassword) {
e.preventDefault(); // Prevent form submission
alert('Passwords do not match!');
}
});
</script>
</body> </body>
</html> </html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment