<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Password Prompt</title>

    <script>
        // Extract shortUrl from the current URL
        var shortUrl = window.location.pathname.split('/').pop();

        // Update the form action with the correct shortUrl
        document.addEventListener('DOMContentLoaded', function () {
            var form = document.getElementById('passwordForm');
            if (form) {
                form.action = '/' + shortUrl;
            }
        });
    </script>
</head>
<body>
<h2>Password Required</h2>
<!-- Your other body content here -->

<!-- Your password form with an id for easier selection -->
<form id="passwordForm" method="post">

    <!-- Other form fields, password input, etc. -->
    <label for="password">Password:</label>
    <input type="password" id="password" name="password" required />
    <br>

    <!-- Submit button -->
    <button type="submit">Submit</button>

    <p th:if="${error}" style="color: red;">Wrong password. Please try again.</p>
</form>
<div th:replace="layouts/footerLayout"></div>
</body>
</html>
