feat: make account password login explicit

This commit is contained in:
lingniu
2026-07-19 11:25:57 +08:00
parent a82bb28af9
commit 61ca72fab2
4 changed files with 8 additions and 5 deletions

View File

@@ -94,7 +94,8 @@ test('exposes only account and password login on the public sign-in screen', asy
render(<QueryClientProvider client={client}><AuthGate><ProtectedWorkspace onAbort={() => undefined} /></AuthGate></QueryClientProvider>); render(<QueryClientProvider client={client}><AuthGate><ProtectedWorkspace onAbort={() => undefined} /></AuthGate></QueryClientProvider>);
expect(await screen.findByRole('form', { name: '平台账号登录' })).toBeInTheDocument(); expect(await screen.findByRole('form', { name: '账号密码登录' })).toBeInTheDocument();
expect(screen.getByText('使用管理员为你开通的账号和密码登录。')).toBeInTheDocument();
expect(screen.getByPlaceholderText('请输入用户名')).toHaveAttribute('autocomplete', 'username'); expect(screen.getByPlaceholderText('请输入用户名')).toHaveAttribute('autocomplete', 'username');
expect(screen.getByPlaceholderText('请输入密码')).toHaveAttribute('autocomplete', 'current-password'); expect(screen.getByPlaceholderText('请输入密码')).toHaveAttribute('autocomplete', 'current-password');
expect(screen.queryByRole('tab')).not.toBeInTheDocument(); expect(screen.queryByRole('tab')).not.toBeInTheDocument();

View File

@@ -147,12 +147,12 @@ export function AuthGate({ children }: { children: ReactNode }) {
<footer><IconLock /><Text></Text></footer> <footer><IconLock /><Text></Text></footer>
</section> </section>
<Card className="v2-auth-card" bodyStyle={{ padding: 0 }}> <Card className="v2-auth-card" bodyStyle={{ padding: 0 }}>
<form className="v2-auth-form" onSubmit={login} aria-label="平台账号登录"> <form className="v2-auth-form" onSubmit={login} aria-label="账号密码登录">
<header className="v2-auth-form-heading"> <header className="v2-auth-form-heading">
<img className="v2-auth-logo" src="/brand-logo.svg" alt="羚牛智能" /> <img className="v2-auth-logo" src="/brand-logo.svg" alt="羚牛智能" />
<Tag color="blue" prefixIcon={<IconUser />}></Tag> <Tag color="blue" prefixIcon={<IconUser />}></Tag>
<Title heading={3}></Title> <Title heading={3}></Title>
<Text type="secondary">使</Text> <Text type="secondary">使</Text>
</header> </header>
<div className="v2-auth-fields"> <div className="v2-auth-fields">
<label><span></span><Input autoFocus required autoComplete="username" prefix={<IconUser aria-hidden="true" />} value={username} onChange={setUsername} placeholder="请输入用户名" size="large" /></label> <label><span></span><Input autoFocus required autoComplete="username" prefix={<IconUser aria-hidden="true" />} value={username} onChange={setUsername} placeholder="请输入用户名" size="large" /></label>

View File

@@ -653,6 +653,8 @@ describe('V2 production entry', () => {
expect(authGateSource.match(/<PasswordInput/g)).toHaveLength(1); expect(authGateSource.match(/<PasswordInput/g)).toHaveLength(1);
expect(authGateSource).not.toContain('<Tabs'); expect(authGateSource).not.toContain('<Tabs');
expect(authGateSource).not.toContain('运维令牌'); expect(authGateSource).not.toContain('运维令牌');
expect(authGateSource).toContain('aria-label="账号密码登录"');
expect(authGateSource).toContain('>账号密码登录</Tag>');
expect(passwordInputSource).toContain('<Input'); expect(passwordInputSource).toContain('<Input');
expect(passwordInputSource).toContain('<Button'); expect(passwordInputSource).toContain('<Button');
expect(passwordInputSource).toContain("`${visible ? '隐藏' : '显示'}${visibilityLabel}`"); expect(passwordInputSource).toContain("`${visible ? '隐藏' : '显示'}${visibilityLabel}`");

View File

@@ -5754,7 +5754,7 @@
font-size: 10px; font-size: 10px;
} }
/* Semi UI identity workspace: one explicit account and operations entry system. */ /* Semi UI identity workspace: one explicit account-and-password entry system. */
.v2-auth-screen:not(.is-session-loading) { .v2-auth-screen:not(.is-session-loading) {
grid-template-columns: minmax(430px, 1.12fr) minmax(420px, 460px); grid-template-columns: minmax(430px, 1.12fr) minmax(420px, 460px);
column-gap: clamp(34px, 5vw, 82px); column-gap: clamp(34px, 5vw, 82px);