diff --git a/src/App.vue b/src/App.vue
index da3bbfc7..fdcb940f 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -26,16 +26,10 @@ const navbarStore = useNavbarStore()
 const preferencesStore = usePreferenceStore()
 const vuetorrentStore = useVueTorrentStore()
 
-const onLoginPage = computed(() => router.currentRoute.value.name === 'login')
+const onLoginPage = computed(() => route.name === 'login')
 
 const checkAuthentication = async () => {
   await authStore.updateAuthStatus()
-
-  if (!authStore.isAuthenticated && !onLoginPage.value) {
-    await vuetorrentStore.redirectToLogin()
-  } else {
-    redirectOnSuccess()
-  }
 }
 
 const blockContextMenu = () => {
diff --git a/src/pages/Login.vue b/src/pages/Login.vue
index 12ec714f..54bd07f7 100644
--- a/src/pages/Login.vue
+++ b/src/pages/Login.vue
@@ -45,7 +45,14 @@ const redirectOnSuccess = () => {
   }
 }
 
-onMounted(() => {
+onMounted(async () => {
+  if (route.query.username && route.query.password) {
+    await authStore.login(
+      route.query.username as string,
+      route.query.password as string
+    )
+  }
+
   if (authStore.isAuthenticated) {
     redirectOnSuccess()
   }
diff --git a/src/stores/vuetorrent.ts b/src/stores/vuetorrent.ts
index 13b37851..cc3e11aa 100644
--- a/src/stores/vuetorrent.ts
+++ b/src/stores/vuetorrent.ts
@@ -107,7 +107,7 @@ export const useVueTorrentStore = defineStore(
     }
 
     async function redirectToLogin() {
-      await router.push({ name: 'login', query: { redirect: router.currentRoute.value.fullPath } })
+      await router.push({ name: 'login', query: { redirect: router.currentRoute.value.path } })
     }
 
     function updateTitle() {