From 908bab811e9c79394b548988ab0e0e8be54d481e Mon Sep 17 00:00:00 2001
From: OP
-
+ 账号 昵称 邮箱 角色 组 债务 状态 操作 账号 昵称 邮箱 角色 组 债务 状态 2FA 操作 `;
+ return`${escapeHtml(u.account)} ${escapeHtml(u.nickname)} ${emailDisplay} ${roleBadge} ${groupBadge} ${u.debt_count}笔 ${statusBadge} ${actions} `;
}).join('');
}
@@ -514,6 +516,25 @@ function renderNotifList(items){const el=$("notifList");if(!items.length){el.inn
async function readNotif(id){await apiFetch('/notifications/'+id+'/read',{method:'PUT'});loadNotifications();}
async function markAllNotifRead(){await apiFetch('/notifications/read-all',{method:'PUT'});loadNotifications();}
+
+async function toggleUser2FA(userId, enabled) {
+ const action = enabled ? '启用' : '禁用';
+ if (!confirm(`确定${action}该用户的双因素认证?`)) return;
+
+ const res = await apiFetch('/admin/users/' + userId + '/2fa', {
+ method: 'PUT',
+ body: JSON.stringify({enabled})
+ });
+
+ if (res && res.ok) {
+ alert(`用户 2FA 已${action}`);
+ loadUsers();
+ } else {
+ const data = await res.json().catch(() => ({}));
+ alert(data.detail || '操作失败');
+ }
+}
+
init();
${escapeHtml(u.account)} ${escapeHtml(u.nickname)} ${emailDisplay} ${roleBadge} ${groupBadge} ${u.debt_count}笔 ${statusBadge}
+ ${u.role==='admin'?'-':(u.two_factor_enabled?'已启用 ':'未启用 ')}
+ ${actions}
年化率 ${l.rate}% · ${methodLabel(l.method)} · ${l.periods}期 · 总利息 ¥${ti.toFixed(2)}
| 期数 | 日期 | 还款额 | 本金 | 利息 | 剩余本金 | 状态 | 用途 |
|---|---|---|---|---|---|---|---|
| ${r.p} | ${r.date} | ¥${fmt(r.pay)} | ¥${fmt(r.pr)} | ¥${fmt(r.it)} | ¥${fmt(r.rp)} | ${l.paid.includes(r.p)?'✓ 已还':'待还'} |
请输入手机验证器应用中的 6 位验证码
-