client/web: only trigger check mode if not authed

After logging in, the `?check=now` query string is still present if it
was passed. Reloading the page causes a new check mode to be triggered,
even though the user has an active session. Only trigger the automatic
check mode if the user is not already able to manage the device.

Updates tailscale/corp#14335

Signed-off-by: Will Norris <will@tailscale.com>
This commit is contained in:
Will Norris 2023-11-14 11:00:23 -08:00 committed by Will Norris
parent 79719f05a9
commit 74947ce459

View File

@ -41,6 +41,7 @@ export default function useAuth() {
default: default:
setLoading(false) setLoading(false)
} }
return d
}) })
.catch((error) => { .catch((error) => {
setLoading(false) setLoading(false)
@ -64,10 +65,14 @@ export default function useAuth() {
}, []) }, [])
useEffect(() => { useEffect(() => {
loadAuth() loadAuth().then((d) => {
if (new URLSearchParams(window.location.search).get("check") == "now") { if (
newSession() !d.canManageNode &&
} new URLSearchParams(window.location.search).get("check") == "now"
) {
newSession()
}
})
}, []) }, [])
return { return {