Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.

Commit 959ec2d

Browse files
authored
Merge pull request #20 from Delivator/patch-1
Fix #19 adding return_to to login button
2 parents ced1865 + 7bf15c6 commit 959ec2d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

nginx/templates/pages/401.html.template

+8-1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
<a
7070
href="https://account.${PORTAL_DOMAIN}/auth/login"
7171
class="text-[#00C65E]"
72+
id="login-btn"
7273
>click here</a
7374
>.
7475
</p>
@@ -78,11 +79,17 @@
7879
</div>
7980
</div>
8081
<script>
82+
const encodedReturnTo = encodeURIComponent(window.location.href);
83+
const portalLoginUrl = `https://account.${PORTAL_DOMAIN}/auth/login?return_to=${encodedReturnTo}`
84+
85+
// add return_to url to click here button
86+
document.getElementById("login-btn").href = portalLoginUrl;
87+
8188
// prevent auto redirect if not on portal domain to allow local development
8289
if (window.location.hostname.endsWith("${PORTAL_DOMAIN}")) {
8390
setTimeout(function redirect() {
8491
const encodedReturnTo = encodeURIComponent(window.location.href);
85-
window.location.href = `https://account.${PORTAL_DOMAIN}/auth/login?return_to=${encodedReturnTo}`;
92+
window.location.href = portalLoginUrl;
8693
}, 5000); // redirect after 5 seconds
8794
}
8895
</script>

0 commit comments

Comments
 (0)