Login redirect now set via thymeleaf not JS

This commit is contained in:
neviyn 2021-06-15 09:49:24 +01:00
parent 71fcbd5ef0
commit eec46598f6

View File

@ -36,7 +36,7 @@
</div> </div>
<form class="form-sign_in" method="POST" sec:authorize="!isAuthenticated()" th:action="@{/login}"> <form class="form-sign_in" method="POST" sec:authorize="!isAuthenticated()" th:action="@{/login}">
<div class="form-group d-flex flex-row align-items-center"> <div class="form-group d-flex flex-row align-items-center">
<input id="redirectURL" name="redirect" type="hidden" value=""> <input id="redirectURL" name="redirect" type="hidden" th:value="${#httpServletRequest.requestURI} + (${#httpServletRequest.queryString} ? '?' + ${#httpServletRequest.queryString} : '')">
<!--suppress HtmlFormInputWithoutLabel --> <!--suppress HtmlFormInputWithoutLabel -->
<input class="form-control form-control-sm" id="username" name="username" placeholder="Username" type="text" autocomplete="username"> <input class="form-control form-control-sm" id="username" name="username" placeholder="Username" type="text" autocomplete="username">
<!--suppress HtmlFormInputWithoutLabel --> <!--suppress HtmlFormInputWithoutLabel -->
@ -45,10 +45,6 @@
<button class="btn btn-primary btn-sm text-nowrap" type="submit">Log In</button> <button class="btn btn-primary btn-sm text-nowrap" type="submit">Log In</button>
<a class="btn btn-secondary btn-sm" th:href="@{/register}">Register</a> <a class="btn btn-secondary btn-sm" th:href="@{/register}">Register</a>
</div> </div>
<script>
// Set logging in via this page to redirect back to this exact page
document.getElementById('redirectURL').setAttribute('value', window.location.href)
</script>
</form> </form>
</div> </div>
</div> </div>