多用户与角色:新增系统管理员 + 用户管理
- 新增 users 表(scrypt 口令哈希)与持久化层,启动兜底种子账号 - 登录改为后端用户表校验账号密码;JWT 带角色;保留无DB演示回退 - 新增系统管理员角色 + 用户管理页(增删改/改角色/启停/重置密码) - 用户管理端点按 系统管理员 角色强制校验(RBAC) - 各角色可建任意多个账号(多销售/多风控/多管理) - 更新登录页快速登录与首屏快照
This commit is contained in:
@@ -20,10 +20,10 @@ export function Login(): JSX.Element {
|
||||
const [username, setUsername] = useState('');
|
||||
const [password, setPassword] = useState('');
|
||||
|
||||
const handleSubmit = (e: React.FormEvent): void => {
|
||||
const handleSubmit = async (e: React.FormEvent): Promise<void> => {
|
||||
e.preventDefault();
|
||||
clearError();
|
||||
const ok = login(username, password);
|
||||
const ok = await login(username, password);
|
||||
if (ok) {
|
||||
navigate('/');
|
||||
}
|
||||
@@ -109,7 +109,7 @@ export function Login(): JSX.Element {
|
||||
</div>
|
||||
|
||||
<div style={cardStyle}>
|
||||
<form onSubmit={handleSubmit} style={{ display: 'flex', flexDirection: 'column', gap: `${space(3)}px` }}>
|
||||
<form onSubmit={(e) => { void handleSubmit(e); }} style={{ display: 'flex', flexDirection: 'column', gap: `${space(3)}px` }}>
|
||||
<div>
|
||||
<label style={{ display: 'block', marginBottom: `${space(1)}px`, color: colorVar('color.text.secondary'), ...typographyStyle('caption') }}>
|
||||
用户名
|
||||
|
||||
Reference in New Issue
Block a user