feat(auth): add change password API and frontend page

Backend:
- Add ChangePasswordReq DTO with validation (current + new password)
- Add AuthService::change_password() method with credential verification,
  password rehash, and token revocation
- Add POST /api/v1/auth/change-password endpoint with utoipa annotation

Frontend:
- Add changePassword() API function in auth.ts
- Add ChangePassword.tsx page with form validation and confirmation
- Add "修改密码" tab in Settings page

After password change, all refresh tokens are revoked and the user
is redirected to the login page.
This commit is contained in:
iven
2026-04-15 01:32:18 +08:00
parent d8a0ac7519
commit 7e8fabb095
8 changed files with 267 additions and 1 deletions

View File

@@ -7,6 +7,7 @@ import {
SettingOutlined,
BgColorsOutlined,
AuditOutlined,
LockOutlined,
} from '@ant-design/icons';
import DictionaryManager from './settings/DictionaryManager';
import LanguageManager from './settings/LanguageManager';
@@ -15,6 +16,7 @@ import NumberingRules from './settings/NumberingRules';
import SystemSettings from './settings/SystemSettings';
import ThemeSettings from './settings/ThemeSettings';
import AuditLogViewer from './settings/AuditLogViewer';
import ChangePassword from './settings/ChangePassword';
const Settings: React.FC = () => {
return (
@@ -100,6 +102,16 @@ const Settings: React.FC = () => {
),
children: <AuditLogViewer />,
},
{
key: 'change-password',
label: (
<span style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
<LockOutlined style={{ fontSize: 14 }} />
</span>
),
children: <ChangePassword />,
},
]}
/>
</div>