fix: 踢下线同时禁用账号防重连,禁止管理员踢自己
- handler/vpn.go: KickUserClient 踢线后设置 status=0 并失效所有会话, 阻止客户端自动重连;新增自检,目标为当前管理员时返回 400 - AdminView.vue: handleKick 调用 API 前自检,自己则提示去修改密码 - zh.ts/en.ts: 新增 cannotKickSelf,更新 confirmKick 提示含禁用账号
This commit is contained in:
@@ -83,8 +83,12 @@ async function fetchVpnStatus() {
|
||||
}
|
||||
|
||||
async function handleKick(userId: number, username: string) {
|
||||
if (!confirm(t('vpn.confirmKick', { username }))) return
|
||||
kickError.value = ''
|
||||
if (userId === authStore.user?.id) {
|
||||
kickError.value = t('vpn.cannotKickSelf')
|
||||
return
|
||||
}
|
||||
if (!confirm(t('vpn.confirmKick', { username }))) return
|
||||
try {
|
||||
const res = await fetch(`/api/admin/vpn/clients/${userId}`, {
|
||||
method: 'DELETE',
|
||||
|
||||
Reference in New Issue
Block a user