mirror of
https://github.com/fankes/beszel.git
synced 2025-10-19 17:59:28 +08:00
fix: allow logout if auto login if enabled
This commit is contained in:
@@ -135,7 +135,6 @@ export function UserAuthForm({
|
|||||||
toast({
|
toast({
|
||||||
title: t`Error`,
|
title: t`Error`,
|
||||||
description: t`Please enable pop-ups for this site`,
|
description: t`Please enable pop-ups for this site`,
|
||||||
variant: "destructive",
|
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -156,8 +155,11 @@ export function UserAuthForm({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// auto login if password disabled and only one auth provider
|
// auto login if password disabled and only one auth provider
|
||||||
if (!passwordEnabled && authProviders.length === 1) {
|
if (!passwordEnabled && authProviders.length === 1 && !sessionStorage.getItem("lo")) {
|
||||||
loginWithOauth(authProviders[0], true)
|
// Add a small timeout to ensure browser is ready to handle popups
|
||||||
|
setTimeout(() => {
|
||||||
|
loginWithOauth(authProviders[0], true)
|
||||||
|
}, 300)
|
||||||
}
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
@@ -77,6 +77,7 @@ export const updateSystemList = (() => {
|
|||||||
|
|
||||||
/** Logs the user out by clearing the auth store and unsubscribing from realtime updates. */
|
/** Logs the user out by clearing the auth store and unsubscribing from realtime updates. */
|
||||||
export async function logOut() {
|
export async function logOut() {
|
||||||
|
sessionStorage.setItem("lo", "t")
|
||||||
pb.authStore.clear()
|
pb.authStore.clear()
|
||||||
pb.realtime.unsubscribe()
|
pb.realtime.unsubscribe()
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user