🔥 移除旧密码重置审核系统 & 优化存储管理UI

后端改进:
- 移除需要管理员审核的密码重置请求功能
- 简化密码重置流程,直接使用邮件重置
- 删除 password_reset_requests 表及相关代码

前端优化:
- 重新设计存储管理界面,采用现代化渐变风格
- 改进存储方式切换交互,添加动画效果
- 优化视觉层次和信息展示

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-24 19:12:57 +08:00
parent 104d7fe0ef
commit 02f0f3aa24
4 changed files with 138 additions and 297 deletions

View File

@@ -113,9 +113,6 @@ createApp({
resetPwdUser: {},
newPassword: '',
// 密码重置审核
passwordResetRequests: [],
// 文件审查
showFileInspectionModal: false,
inspectionUser: null,
@@ -213,7 +210,11 @@ createApp({
uploadingTool: false, // 是否正在上传工具
// 强制显示SFTP配置用于本地存储模式下临时显示SFTP配置
forceSftpConfigVisible: false
forceSftpConfigVisible: false,
// 存储切换状态
storageSwitching: false,
storageSwitchTarget: null
};
},
@@ -1692,44 +1693,6 @@ handleDragLeave(e) {
}
},
// ===== 管理员:密码重置审核 =====
async loadPasswordResetRequests() {
try {
const response = await axios.get(`${this.apiBase}/api/admin/password-reset/pending`, {
headers: { Authorization: `Bearer ${this.token}` }
});
if (response.data.success) {
this.passwordResetRequests = response.data.requests;
}
} catch (error) {
console.error('加载密码重置请求失败:', error);
this.showToast('error', '错误', '加载密码重置请求失败');
}
},
async reviewPasswordReset(requestId, approved) {
const action = approved ? '批准' : '拒绝';
if (!confirm(`确定要${action}这个密码重置请求吗?`)) return;
try {
const response = await axios.post(
`${this.apiBase}/api/admin/password-reset/${requestId}/review`,
{ approved },
{ headers: { Authorization: `Bearer ${this.token}` } }
);
if (response.data.success) {
this.showToast('success', '成功', response.data.message);
this.loadPasswordResetRequests();
}
} catch (error) {
console.error('审核失败:', error);
this.showToast('error', '错误', error.response?.data?.message || '审核失败');
}
},
// ===== 管理员:文件审查功能 =====
async openFileInspection(user) {
@@ -1876,10 +1839,30 @@ handleDragLeave(e) {
return;
}
if (!confirm(`确定要切换到${type === 'local' ? '本地存储' : 'SFTP存储'}吗?`)) {
if (this.storageSwitching || type === this.storageType) {
return;
}
// 切到SFTP但还未配置引导去配置
if (type === 'sftp' && (!this.user?.has_ftp_config)) {
this.showToast('info', '需要配置SFTP', '请先填写SFTP信息再切换');
this.currentView = 'settings';
this.forceSftpConfigVisible = true;
if (this.user && !this.user.is_admin) {
this.loadFtpConfig();
}
this.$nextTick(() => {
const sftpSection = document.getElementById('sftp-config-section');
if (sftpSection) {
sftpSection.scrollIntoView({ behavior: 'smooth', block: 'start' });
}
});
return;
}
this.storageSwitching = true;
this.storageSwitchTarget = type;
try {
const response = await axios.post(
`${this.apiBase}/api/user/switch-storage`,
@@ -1899,6 +1882,9 @@ handleDragLeave(e) {
} catch (error) {
console.error('切换存储失败:', error);
this.showToast('error', '错误', error.response?.data?.message || '切换存储失败');
} finally {
this.storageSwitching = false;
this.storageSwitchTarget = null;
}
},
@@ -2308,7 +2294,6 @@ handleDragLeave(e) {
} else if (newView === 'admin' && this.user?.is_admin) {
this.loadUsers();
this.loadSystemSettings();
this.loadPasswordResetRequests();
this.loadServerStorageStats();
} else if (newView === 'settings' && this.user && !this.user.is_admin) {
// 普通用户进入设置页面时加载SFTP配置