summary refs log tree commit diff
path: root/api
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-07-09 18:58:17 +1000
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-07-09 18:58:17 +1000
commit879bfa7391fef0afd3c9980ac993d39ab40b5609 (patch)
tree677a668c86bc377cfbea49fd8af454fc7fb7ddf2 /api
parentMerge branch 'fix/registerNewClients' into slowcord (diff)
downloadserver-879bfa7391fef0afd3c9980ac993d39ab40b5609.tar.xz
Redirect to custom login page when client navigates to /login or /register
Diffstat (limited to 'api')
-rw-r--r--api/assets/preload-plugins/loginRedirect.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/api/assets/preload-plugins/loginRedirect.js b/api/assets/preload-plugins/loginRedirect.js
new file mode 100644
index 00000000..895536ef
--- /dev/null
+++ b/api/assets/preload-plugins/loginRedirect.js
@@ -0,0 +1,13 @@
+const redirectIfOnLogin = () => {
+	const path = window.location.pathname;
+	if (path == "/login" || path == "/register") {
+		window.location.reload();
+	}
+}
+
+const observer = new MutationObserver((mutations) => {
+	redirectIfOnLogin();
+});
+observer.observe(document, { subtree: true, childList: true })
+
+redirectIfOnLogin();
\ No newline at end of file