fix netlify redirection

This commit is contained in:
generall
2023-12-28 11:55:27 +00:00
parent f61df8d456
commit fadd83d87b
@@ -67,6 +67,46 @@
});
</script>
{{ if .IsHome }}
<script>
// Check that current url contains `?token=...` parameter
// And if so, redirec to `/admin?token=...` page
// Get the current URL
const url = window.location.href;
// Use URLSearchParams to parse the query parameters
const params = new URLSearchParams(url.split('#')[1]);
// Check if the 'token' parameter is present
if (params.has('recovery_token')) {
// Get the value of the 'token' parameter
const token = params.get('recovery_token');
// Redirect to the '/admin' page with the same 'token' parameter
window.location.href = '/admin/#recovery_token=' + token;
}
// Check if the 'token' parameter is present
if (params.has('invite_token')) {
// Get the value of the 'token' parameter
const token = params.get('invite_token');
// Redirect to the '/admin' page with the same 'token' parameter
window.location.href = '/admin/#invite_token=' + token;
}
// Check if the 'token' parameter is present
if (params.has('confirmation_token')) {
// Get the value of the 'token' parameter
const token = params.get('confirmation_token');
// Redirect to the '/admin' page with the same 'token' parameter
window.location.href = '/admin/#confirmation_token=' + token;
}
</script>
{{ end }}
{{ if not .IsHome }}
<!-- MathJax support -->