mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-11-30 09:32:45 +01:00
Explain why the Pulse sign-in form is hidden (#4752)
Explain the empty sign-in chooser when the local form is hidden and Pulse lists no single sign-on provider. Keep demo progress, explain an incomplete automatic attempt, and qualify the manual instructions without offering another login method. Contract-Neutral: Presentation-only guidance uses existing discovery and demo results; sign-in policy, setup, fallback, credential handling, request admission and routes are unchanged. --- Fleet candidate `20261120T092802Z-web-product` from the `web-product` lane. Reviewed tip `2b0a8e645fc63422c36cbe6978cdc276f5bdee05` on `main`. [How Pulse handles triage](https://github.com/rcourtman/Pulse/blob/main/docs/AI_TRANSPARENCY.md)
This commit is contained in:
37
frontend-modern/browser-verification/fbe1702c20820db4.json
Normal file
37
frontend-modern/browser-verification/fbe1702c20820db4.json
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"version": 1,
|
||||
"base_sha": "1bf7be29811cbb40eddbd105d671971276743940",
|
||||
"verified_at": "2026-11-20T09:39:32Z",
|
||||
"result": "passed",
|
||||
"changed_paths": [
|
||||
"frontend-modern/src/components/Login.tsx"
|
||||
],
|
||||
"content_sha256": {
|
||||
"frontend-modern/src/components/Login.tsx": "405c92eeac595ce065d1fd9cbcc18b1c818f3cee4c869d7a165193f502c5fc9d"
|
||||
},
|
||||
"routes": [
|
||||
"/login",
|
||||
"/docs/TROUBLESHOOTING"
|
||||
],
|
||||
"viewports": [
|
||||
{
|
||||
"width": 1366,
|
||||
"height": 820
|
||||
},
|
||||
{
|
||||
"width": 320,
|
||||
"height": 700
|
||||
}
|
||||
],
|
||||
"states": [
|
||||
"Real Pulse App at /login with local fixture replies to the existing security-status, health and demo login requests; Playwright 1.56.1, desktop Chromium 141 light and narrow WebKit 26 dark.",
|
||||
"Matched native pixel review: the empty sign-in card now explains the hidden local form and unlisted SSO choices without obscuring keyboard-focusable Help.",
|
||||
"Pending Demo Mode and SSO-only views are unchanged in both pairs. After a demo refusal, the banner names the incomplete attempt and qualifies the already visible manual instructions. After reload it gives only the qualified instructions.",
|
||||
"Ten desktop and narrow before/after pairs, no horizontal overflow. Ordinary local fields remain available when offered; no real IdP, installed sign-in or release exercised."
|
||||
],
|
||||
"interactions": [
|
||||
"198 baseline and 208 candidate browser assertions. Tab and Enter reach the Troubleshooting route from the empty chooser.",
|
||||
"A held demo POST renders the existing progress. Its synthetic 401 replaces progress in the same live region without showing raw reply text or stealing focus from Help. Reload in the same tab does not submit again.",
|
||||
"Tab and Enter activate the advertised local SSO fixture URL. No local password form or credential POST is added when it is hidden."
|
||||
]
|
||||
}
|
||||
@@ -518,23 +518,25 @@ const LoginForm: Component<{
|
||||
</div>
|
||||
<div class="flex-1">
|
||||
<div class="font-semibold text-sm text-base-content">Demo Mode</div>
|
||||
<Show
|
||||
when={demoAutoLogin()}
|
||||
fallback={
|
||||
<div class="text-sm text-muted">
|
||||
Login with{' '}
|
||||
<code class="bg-blue-100 dark:bg-blue-900/25 text-blue-700 dark:text-blue-300 px-1.5 py-0.5 rounded-sm font-mono text-xs">
|
||||
demo
|
||||
</code>{' '}
|
||||
/{' '}
|
||||
<code class="bg-blue-100 dark:bg-blue-900/25 text-blue-700 dark:text-blue-300 px-1.5 py-0.5 rounded-sm font-mono text-xs">
|
||||
demo
|
||||
</code>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<div class="text-sm text-muted" role="status">
|
||||
Signing you in to the demo…
|
||||
<div class="text-sm text-muted" role="status">
|
||||
{demoAutoLogin()
|
||||
? 'Signing you in to the demo…'
|
||||
: !showLocalLogin && error()
|
||||
? 'Automatic demo sign-in didn’t complete.'
|
||||
: ''}
|
||||
</div>
|
||||
<Show when={!demoAutoLogin()}>
|
||||
<div class="text-sm text-muted">
|
||||
{showLocalLogin
|
||||
? 'Login with'
|
||||
: 'The local sign-in form is hidden. If your administrator offers local sign-in, use'}{' '}
|
||||
<code class="bg-blue-100 dark:bg-blue-900/25 text-blue-700 dark:text-blue-300 px-1.5 py-0.5 rounded-sm font-mono text-xs">
|
||||
demo
|
||||
</code>{' '}
|
||||
/{' '}
|
||||
<code class="bg-blue-100 dark:bg-blue-900/25 text-blue-700 dark:text-blue-300 px-1.5 py-0.5 rounded-sm font-mono text-xs">
|
||||
demo
|
||||
</code>
|
||||
</div>
|
||||
</Show>
|
||||
</div>
|
||||
@@ -563,6 +565,15 @@ const LoginForm: Component<{
|
||||
class="mt-8 space-y-6 bg-surface rounded-md p-8 shadow-xs border border-border animate-slide-up"
|
||||
onSubmit={handleSubmit}
|
||||
>
|
||||
<Show when={!showLocalLogin && ssoProviders.length === 0 && !demoModeEnabled}>
|
||||
<div class="space-y-2 text-sm">
|
||||
<h3 class="font-semibold text-base-content">No sign-in options on this page</h3>
|
||||
<p class="text-muted">
|
||||
The local sign-in form is hidden and Pulse didn’t list a single sign-on provider.
|
||||
Ask your Pulse administrator how to sign in.
|
||||
</p>
|
||||
</div>
|
||||
</Show>
|
||||
{/* Multi-Provider SSO Section */}
|
||||
<Show when={ssoProviders.length > 0}>
|
||||
<div class="space-y-3">
|
||||
|
||||
@@ -125,6 +125,32 @@ describe('Login', () => {
|
||||
'href',
|
||||
'/docs/TROUBLESHOOTING',
|
||||
);
|
||||
expect(screen.queryByRole('heading', { name: 'No sign-in options on this page' })).toBeNull();
|
||||
});
|
||||
|
||||
it('explains a discovered hidden form without guessing a provider or offering setup', async () => {
|
||||
mockFetch.mockResolvedValueOnce(
|
||||
new Response(JSON.stringify({ hasAuthentication: true, hideLocalLogin: true }), {
|
||||
status: 200,
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
}),
|
||||
);
|
||||
const onLogin = vi.fn();
|
||||
render(() => <Login onLogin={onLogin} />);
|
||||
|
||||
expect(
|
||||
await screen.findByRole('heading', { name: 'No sign-in options on this page' }),
|
||||
).toBeVisible();
|
||||
expect(screen.getByText(/Ask your Pulse administrator how to sign in/)).toBeVisible();
|
||||
expect(screen.queryByPlaceholderText('Username')).toBeNull();
|
||||
expect(screen.queryByRole('button')).toBeNull();
|
||||
expect(screen.getByRole('link', { name: 'Can’t sign in?' })).toHaveAttribute(
|
||||
'href',
|
||||
'/docs/TROUBLESHOOTING',
|
||||
);
|
||||
expect(mockFetch).toHaveBeenCalledTimes(1);
|
||||
expect(mockFetch.mock.calls[0][0]).toBe('/api/security/status');
|
||||
expect(onLogin).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('shows local login form when show_local=true is in URL even if hideLocalLogin is true', async () => {
|
||||
@@ -184,14 +210,14 @@ describe('Login', () => {
|
||||
expect(mockFetch).not.toHaveBeenCalledWith('/api/security/status');
|
||||
});
|
||||
|
||||
it('shows demo credentials when the visitor has signed out of the demo', async () => {
|
||||
it.each([false, true])('shows demo credentials after sign-out (hidden=%s)', async (hidden) => {
|
||||
// A sign-out marks the tab so the page does not sign the visitor straight
|
||||
// back in; the printed credentials are the way back.
|
||||
window.sessionStorage.setItem(SESSION_STORAGE_KEYS.DEMO_AUTO_LOGIN, 'suppressed');
|
||||
const mockOnLogin = vi.fn();
|
||||
const securityStatus = {
|
||||
hasAuthentication: true,
|
||||
hideLocalLogin: false,
|
||||
hideLocalLogin: hidden,
|
||||
sessionCapabilities: { demoMode: true },
|
||||
};
|
||||
|
||||
@@ -201,11 +227,17 @@ describe('Login', () => {
|
||||
|
||||
expect(await screen.findByText('Demo Mode')).toBeInTheDocument();
|
||||
expect(screen.getAllByText('demo')).toHaveLength(2);
|
||||
expect(screen.queryByText('Signing you in to the demo…')).toBeNull();
|
||||
if (hidden) {
|
||||
expect(screen.getByRole('status')).toBeEmptyDOMElement();
|
||||
expect(screen.getByText(/The local sign-in form is hidden/)).toBeVisible();
|
||||
expect(screen.queryByPlaceholderText('Username')).toBeNull();
|
||||
}
|
||||
expect(mockFetch).not.toHaveBeenCalledWith('/api/login', expect.anything());
|
||||
expect(mockOnLogin).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('signs the visitor in with the demo credentials when the runtime is in demo mode', async () => {
|
||||
it.each([false, true])('signs in to the demo (hidden=%s)', async (hidden) => {
|
||||
const mockOnLogin = vi.fn();
|
||||
mockFetch.mockResolvedValueOnce(
|
||||
new Response(JSON.stringify({ success: true }), {
|
||||
@@ -215,7 +247,7 @@ describe('Login', () => {
|
||||
);
|
||||
const securityStatus = {
|
||||
hasAuthentication: true,
|
||||
hideLocalLogin: false,
|
||||
hideLocalLogin: hidden,
|
||||
presentationPolicy: { demoMode: true },
|
||||
};
|
||||
|
||||
@@ -258,6 +290,48 @@ describe('Login', () => {
|
||||
expect(mockOnLogin).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('keeps hidden-form demo progress and refusal in one live region without exposing the reply', async () => {
|
||||
let finish!: (response: Response) => void;
|
||||
mockFetch.mockReturnValueOnce(
|
||||
new Promise<Response>((resolve) => {
|
||||
finish = resolve;
|
||||
}),
|
||||
);
|
||||
const onLogin = vi.fn();
|
||||
const securityStatus = {
|
||||
hasAuthentication: true,
|
||||
hideLocalLogin: true,
|
||||
presentationPolicy: { demoMode: true },
|
||||
};
|
||||
render(() => <Login onLogin={onLogin} securityStatus={securityStatus as any} />);
|
||||
const status = screen.getByRole('status');
|
||||
const help = screen.getByRole('link', { name: 'Can’t sign in?' });
|
||||
help.focus();
|
||||
|
||||
expect(screen.getByText('Demo Mode')).toBeVisible();
|
||||
expect(status).toHaveTextContent('Signing you in to the demo…');
|
||||
expect(screen.queryByRole('heading', { name: 'No sign-in options on this page' })).toBeNull();
|
||||
expect(screen.queryByText(/^demo$/)).toBeNull();
|
||||
|
||||
finish(
|
||||
new Response(JSON.stringify({ success: false, message: 'Synthetic provider detail' }), {
|
||||
status: 401,
|
||||
}),
|
||||
);
|
||||
|
||||
await waitFor(() =>
|
||||
expect(status).toHaveTextContent('Automatic demo sign-in didn’t complete.'),
|
||||
);
|
||||
expect(screen.getByRole('status')).toBe(status);
|
||||
expect(screen.getByText(/The local sign-in form is hidden/)).toBeVisible();
|
||||
expect(screen.getAllByText('demo')).toHaveLength(2);
|
||||
expect(screen.queryByText('Synthetic provider detail')).toBeNull();
|
||||
expect(screen.queryByPlaceholderText('Username')).toBeNull();
|
||||
expect(help).toHaveFocus();
|
||||
expect(mockFetch.mock.calls.filter(([url]) => url === '/api/login')).toHaveLength(1);
|
||||
expect(onLogin).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('does not restart demo sign-in when pending settles and the tab marker cannot be saved', async () => {
|
||||
const setItem = vi.spyOn(Storage.prototype, 'setItem').mockImplementationOnce(() => {
|
||||
throw new Error('storage unavailable');
|
||||
|
||||
Reference in New Issue
Block a user