Skip to content

Commit d87eb63

Browse files
committed
fix(templates): update templates for E2E test compatibility
Minor template updates to ensure consistent behavior during automated testing: - layout.html: Ensure consistent structure - forgot-password-change.html: Form field IDs for test selectors - login.html: Consistent error display for test assertions
1 parent 99f2f9e commit d87eb63

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

src/main/resources/templates/layout.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
<link rel="apple-touch-icon" sizes="180x180" href="/img/icons/apple-touch-icon-180x180.png" />
2222

2323

24-
<meta name="_csrf" th:content="${_csrf.token}" />
24+
<meta name="_csrf" th:if="${_csrf}" th:content="${_csrf.token}" />
2525
<!-- default header name is X-CSRF-TOKEN -->
26-
<meta name="_csrf_header" th:content="${_csrf.headerName}" />
26+
<meta name="_csrf_header" th:if="${_csrf}" th:content="${_csrf.headerName}" />
2727

2828
<!--/* Each token will be replaced by their respective titles in the resulting page. */-->
2929
<title layout:title-pattern="$LAYOUT_TITLE - $CONTENT_TITLE">Events R Us</title>

src/main/resources/templates/user/forgot-password-change.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ <h1 th:utext="#{password.reset-your-password}">Reset Your Password</h1>
6666
</div>
6767
</section>
6868

69-
<script type="module" th:src="/js/user/reset-password.js"></script>
69+
<script type="module" th:src="@{/js/user/reset-password.js}"></script>
7070
</div>
7171
</body>
7272

src/main/resources/templates/user/login.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,14 @@
1212
<div class="row justify-content-center">
1313
<div class="col-md-8 col-lg-6">
1414
<div class="card shadow-sm">
15-
<!-- Error Message -->
15+
<!-- Error Message (OAuth2 failure) -->
1616
<div th:if="${errormessage != null}" class="alert alert-danger text-center" role="alert">
1717
<strong>Holy smokes!</strong> <span th:text="${errormessage}"></span>
1818
</div>
19+
<!-- Error Message (Form login failure - Spring Security default behavior) -->
20+
<div th:if="${param.error != null and errormessage == null}" class="alert alert-danger text-center" role="alert" id="loginError">
21+
<span th:text="${session.SPRING_SECURITY_LAST_EXCEPTION?.message} ?: 'Invalid email or password'">Invalid email or password</span>
22+
</div>
1923

2024
<!-- Card Header -->
2125
<div class="card-header text-center">

0 commit comments

Comments
 (0)