From 819e73ec1cae169a22051b153aeb3bb5d1e49125 Mon Sep 17 00:00:00 2001 From: os-zhuang Date: Fri, 3 Jul 2026 15:01:09 +0800 Subject: [PATCH] fix(app-shell): don't show the recovery-password reminder on a user's first landing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The RecoveryPasswordReminder banner ("Set a recovery password so you can still sign in if SSO is ever unavailable") fired on the env home whenever an SSO user had no local password — including a brand-new user's very first screen, before they've built anything. Premature: it loads the first-run magic moment with a resilience nudge the user has no reason to care about yet. (The component's own comment already intends "not before the first session"; the code didn't honor it.) Gate on a first-visit marker: record the first home landing, show the reminder only from the next visit onward. Still dismissible; still SSO-fallback resilience for the default (password-allowed) envs. Follow-up: the reminder also shows on SSO-enforced envs where password login is disabled (recovery password unusable there) — that gate is separate. Co-Authored-By: Claude Opus 4.8 --- packages/app-shell/src/console/home/HomePage.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/app-shell/src/console/home/HomePage.tsx b/packages/app-shell/src/console/home/HomePage.tsx index 94a8a1a3c8..07cbacf8f7 100644 --- a/packages/app-shell/src/console/home/HomePage.tsx +++ b/packages/app-shell/src/console/home/HomePage.tsx @@ -188,6 +188,15 @@ function RecoveryPasswordReminder({ t }: { t: (key: string, opts?: any) => strin const [show, setShow] = useState(false); useEffect(() => { if (typeof localStorage !== 'undefined' && localStorage.getItem('os:recovery-pw-dismissed') === '1') return; + // Don't nag on the very first landing: let a brand-new SSO user reach + // their magic moment (build their first app) before asking them to set a + // recovery password. Record the first home visit; show the reminder only + // from the next one on. (The component already intends 'not before the + // first session'; previously the code still fired on the very first screen.) + if (typeof localStorage !== 'undefined' && localStorage.getItem('os:recovery-pw-first-seen') !== '1') { + try { localStorage.setItem('os:recovery-pw-first-seen', '1'); } catch { /* ignore */ } + return; + } let cancelled = false; Promise.resolve(hasLocalPassword?.()) .then((has) => { if (!cancelled && has === false) setShow(true); })