b70557a077
- 单设备登录:登录成功即 last-login-wins 绑定 users.machine;非超管旧 token 在下一次受保护请求抛 4011 下线,超管豁免;仅认 token 内签名 deviceId,不用请求头。 前端两端接入踢下线跳转(?kicked=1 提示),V118 清空历史 machine - 站内通知:新增 notification 模块(任务失败扫描 / 密钥欠费 / 下游服务探测三类来源), 前后台铃铛组件 + 轮询;后台列表按主管数据范围(UserDataScopeSupport)过滤;V116 建表 均已于 2026-09-13 部署上线,此次补提交源码(此前仅存在于已部署 JAR/构建产物中)
29 lines
1.2 KiB
TypeScript
29 lines
1.2 KiB
TypeScript
import test from 'node:test'
|
|
import assert from 'node:assert/strict'
|
|
import { readSource } from './helpers.ts'
|
|
import { isForbidden, isKicked, isUnauthorized } from '../src/api/envelope.ts'
|
|
|
|
test('单设备登录:4011 只认业务码,不被 401/403 判定吞掉', () => {
|
|
assert.equal(isKicked({ code: 4011 }), true)
|
|
assert.equal(isKicked({ code: 401 }), false)
|
|
assert.equal(isKicked({ status: 4011 }), false)
|
|
assert.equal(isKicked(null), false)
|
|
assert.equal(isKicked('4011'), false)
|
|
// 4011 与普通 401/403 是两种处理(提示"已在其他设备登录" vs 跳登录页),不能误判
|
|
assert.equal(isUnauthorized({ code: 4011 }), false)
|
|
assert.equal(isForbidden({ code: 4011 }), false)
|
|
})
|
|
|
|
test('单设备登录:http 拦截器接线(两分支先判 4011,跳带 kicked 标记的登录页)', () => {
|
|
const http = readSource('src/api/http.ts')
|
|
assert.match(http, /isKicked/)
|
|
assert.match(http, /\/admin-vue\/login\?kicked=1/)
|
|
})
|
|
|
|
test('单设备登录:登录页显示被顶下线提示', () => {
|
|
const page = readSource('src/pages/login/LoginPage.vue')
|
|
assert.match(page, /kickedNotice/)
|
|
assert.match(page, /该账号已在其他设备登录/)
|
|
assert.match(page, /kicked-msg/)
|
|
})
|