auto-save 2026-05-29 16:54 (~2)

This commit is contained in:
2026-05-29 16:54:40 +08:00
parent 854947a239
commit 56ea8aef11
2 changed files with 30 additions and 34 deletions

View File

@@ -32,12 +32,6 @@ function loginNextPath() {
return normalizeNextPath(new URLSearchParams(window.location.search).get("next"))
}
function isFeishuClient() {
if (typeof window === "undefined") return false
const ua = window.navigator.userAgent.toLowerCase()
return ua.includes("feishu") || ua.includes("lark")
}
export default function LoginPage() {
const [authConfig, setAuthConfig] = useState<AuthConfig | null>(null)
const [nextPath] = useState(loginNextPath)
@@ -83,7 +77,7 @@ export default function LoginPage() {
const passwordEnabled = authConfig?.password_enabled ?? true
useEffect(() => {
if (!feishuEnabled || status !== "idle" || autoFeishuAttemptedRef.current || !isFeishuClient()) return
if (!feishuEnabled || status !== "idle" || autoFeishuAttemptedRef.current) return
const attemptKey = `skg-feishu-auto-login:${nextPath}`
if (window.sessionStorage.getItem(attemptKey) === "1") return
window.sessionStorage.setItem(attemptKey, "1")
@@ -155,7 +149,7 @@ export default function LoginPage() {
onClick={onFeishuLogin}
>
<Building2 className="h-4 w-4" />
<ArrowRight className="h-4 w-4" />
</button>
) : null}