Files
Agent-System-Frontend/src/components/oneTimePasswordUi.tsx
T
agent-exec-transport 3c22d0957a
governance / governance (pull_request) Successful in 23s
ci / test-and-build (pull_request) Successful in 36s
agent-exec transport f9152d30e9410417157ea4a3a9a926ba/e09f009fa9f5
2026-10-20 01:48:41 +00:00

22 lines
986 B
TypeScript

import type { AdminIssuedOneTimePassword } from '../api'
export interface GeneratedCredential {
owner: string
password: string
kind: 'initial' | 'one-time'
}
export function oneTimePasswordCredential(out: AdminIssuedOneTimePassword): GeneratedCredential {
return { owner: out.owner, password: out.oneTimePassword, kind: 'one-time' }
}
export function GeneratedCredentialPanel({ credential, onClose }: { credential: GeneratedCredential; onClose: () => void }) {
return <div className="ad-reset">
<p className="ad-hint">{credential.kind === 'initial'
? `初始密码仅显示一次,请立即安全交付给 ${credential.owner}。`
: `一次性登录密码仅显示一次,请立即安全交付给 ${credential.owner};使用后必须强制改密。`}</p>
<input className="lg-input ad-mono" readOnly value={credential.password} aria-label="一次性密码" />
<button type="button" className="ad-mini" onClick={onClose}>关闭</button>
</div>
}