feat: Implement pagination and effective account validation for backdoor user login
This commit is contained in:
@@ -151,4 +151,3 @@ backdoor:
|
||||
enabled: true
|
||||
max-users: 100
|
||||
portal-base-path: /shihezi
|
||||
api-base-path: /api/shihezi
|
||||
|
||||
@@ -66,7 +66,6 @@ backdoor:
|
||||
enabled: false
|
||||
max-users: 100
|
||||
portal-base-path: /shihezi
|
||||
api-base-path: /api/shihezi
|
||||
|
||||
# PageHelper分页插件
|
||||
pagehelper:
|
||||
|
||||
@@ -51,10 +51,9 @@
|
||||
<div class="spinner" id="spinner" aria-hidden="true"></div>
|
||||
<h1>正在进入系统</h1>
|
||||
<p>正在以 <span class="user">@@USER_NAME@@</span> 的身份建立登录状态…</p>
|
||||
<p class="error" id="error">登录状态已建立,但自动跳转失败,请手动选择入口。</p>
|
||||
<p class="error" id="error">无法建立登录状态,请返回用户列表后重试。</p>
|
||||
<div class="actions" id="actions">
|
||||
<a id="portalLink" href="#">进入求职门户</a>
|
||||
<a id="managementLink" class="secondary" href="#">进入管理端</a>
|
||||
<a class="secondary" href="?">返回用户列表</a>
|
||||
</div>
|
||||
</main>
|
||||
@@ -64,43 +63,27 @@
|
||||
|
||||
const token = @@TOKEN_JSON@@;
|
||||
const expireAt = @@EXPIRE_AT@@;
|
||||
const apiBase = @@API_BASE_PATH_JSON@@;
|
||||
const portalBase = @@PORTAL_BASE_PATH_JSON@@;
|
||||
const portalUrl = portalBase + '/job-portal';
|
||||
const managementUrl = portalBase + '/management/management/list/index?type=1';
|
||||
|
||||
['userInfo', 'getInfoCache', 'appUserId', 'resume_userId'].forEach(function (key) {
|
||||
localStorage.removeItem(key);
|
||||
sessionStorage.removeItem(key);
|
||||
});
|
||||
sessionStorage.removeItem('user');
|
||||
localStorage.setItem('access_token', token);
|
||||
localStorage.setItem('refresh_token', token);
|
||||
localStorage.setItem('expireTime', String(expireAt));
|
||||
localStorage.removeItem('lcToken');
|
||||
|
||||
document.getElementById('portalLink').href = portalUrl;
|
||||
document.getElementById('managementLink').href = managementUrl;
|
||||
|
||||
fetch(apiBase + '/getInfo', {
|
||||
method: 'GET',
|
||||
cache: 'no-store',
|
||||
credentials: 'same-origin',
|
||||
headers: { 'Authorization': 'Bearer ' + token }
|
||||
})
|
||||
.then(function (response) {
|
||||
if (!response.ok) throw new Error('HTTP ' + response.status);
|
||||
return response.json();
|
||||
})
|
||||
.then(function (result) {
|
||||
if (result.code !== 200) throw new Error('getInfo failed');
|
||||
window.location.replace(result.userType === 'common' ? portalUrl : managementUrl);
|
||||
})
|
||||
.catch(function () {
|
||||
document.getElementById('spinner').style.display = 'none';
|
||||
document.getElementById('error').style.display = 'block';
|
||||
document.getElementById('actions').style.display = 'flex';
|
||||
try {
|
||||
['userInfo', 'getInfoCache', 'appUserId', 'resume_userId'].forEach(function (key) {
|
||||
localStorage.removeItem(key);
|
||||
sessionStorage.removeItem(key);
|
||||
});
|
||||
sessionStorage.removeItem('user');
|
||||
localStorage.setItem('access_token', token);
|
||||
localStorage.setItem('refresh_token', token);
|
||||
localStorage.setItem('expireTime', String(expireAt));
|
||||
localStorage.removeItem('lcToken');
|
||||
window.location.replace(portalUrl);
|
||||
} catch (error) {
|
||||
document.getElementById('spinner').style.display = 'none';
|
||||
document.getElementById('error').style.display = 'block';
|
||||
document.getElementById('actions').style.display = 'flex';
|
||||
}
|
||||
}());
|
||||
</script>
|
||||
</body>
|
||||
|
||||
@@ -8,31 +8,31 @@
|
||||
<title>测试用户登录</title>
|
||||
<style>
|
||||
* { box-sizing: border-box; }
|
||||
html, body { width: 100%; height: 100%; overflow: hidden; }
|
||||
body {
|
||||
margin: 0;
|
||||
min-height: 100vh;
|
||||
padding: 40px 20px;
|
||||
padding: 0;
|
||||
color: #1f2937;
|
||||
background: linear-gradient(145deg, #eef4ff 0%, #f7f9fc 48%, #eef7f4 100%);
|
||||
font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
|
||||
}
|
||||
.panel {
|
||||
width: min(1120px, 100%);
|
||||
margin: 0 auto;
|
||||
display: flex;
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
min-height: 0;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
border: 1px solid rgba(15, 23, 42, .08);
|
||||
border-radius: 18px;
|
||||
background: rgba(255, 255, 255, .96);
|
||||
box-shadow: 0 22px 55px rgba(31, 41, 55, .10);
|
||||
}
|
||||
header { padding: 28px 30px 22px; border-bottom: 1px solid #edf0f5; }
|
||||
h1 { margin: 0; color: #111827; font-size: 24px; line-height: 1.35; }
|
||||
.subtitle { margin: 8px 0 0; color: #6b7280; }
|
||||
header { flex: none; padding: 16px 28px 14px; border-bottom: 1px solid #edf0f5; }
|
||||
h1 { margin: 0; color: #111827; font-size: 22px; line-height: 1.3; }
|
||||
.subtitle { margin: 4px 0 0; color: #6b7280; }
|
||||
.warning {
|
||||
margin-top: 18px;
|
||||
padding: 10px 13px;
|
||||
margin-top: 10px;
|
||||
padding: 8px 12px;
|
||||
border: 1px solid #f5d995;
|
||||
border-radius: 9px;
|
||||
border-radius: 8px;
|
||||
color: #7c4a03;
|
||||
background: #fff9e8;
|
||||
}
|
||||
@@ -41,10 +41,11 @@
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 18px 30px;
|
||||
flex: none;
|
||||
padding: 11px 28px;
|
||||
border-bottom: 1px solid #edf0f5;
|
||||
}
|
||||
form { display: flex; flex: 1; max-width: 620px; gap: 9px; }
|
||||
form { display: flex; flex: 1; max-width: 760px; gap: 9px; }
|
||||
input {
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
@@ -70,16 +71,24 @@
|
||||
line-height: 40px;
|
||||
}
|
||||
.count { flex: none; color: #6b7280; }
|
||||
.table-wrap { overflow-x: auto; }
|
||||
table { width: 100%; border-collapse: collapse; }
|
||||
th, td { padding: 14px 16px; border-bottom: 1px solid #edf0f5; text-align: left; white-space: nowrap; }
|
||||
.table-wrap { min-height: 0; flex: 1; overflow: hidden; }
|
||||
table { width: 100%; height: 100%; border-collapse: collapse; table-layout: fixed; }
|
||||
th, td {
|
||||
height: 44px;
|
||||
padding: 7px 16px;
|
||||
overflow: hidden;
|
||||
border-bottom: 1px solid #edf0f5;
|
||||
text-align: left;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
th { color: #667085; background: #fafbfc; font-size: 13px; font-weight: 600; }
|
||||
tbody tr:hover { background: #f8fbff; }
|
||||
td.id { color: #667085; font-variant-numeric: tabular-nums; }
|
||||
td.action { text-align: right; }
|
||||
td.action { padding: 6px 12px; overflow: visible; text-align: center; }
|
||||
td.action a {
|
||||
display: inline-block;
|
||||
padding: 7px 13px;
|
||||
padding: 6px 11px;
|
||||
border-radius: 7px;
|
||||
color: #fff;
|
||||
background: #1677ff;
|
||||
@@ -89,14 +98,50 @@
|
||||
td.action a:hover { background: #0958d9; }
|
||||
.kind { color: #344054; }
|
||||
small { color: #98a2b3; }
|
||||
.empty { height: 150px; color: #98a2b3; text-align: center; }
|
||||
footer { padding: 16px 30px 20px; color: #98a2b3; font-size: 12px; }
|
||||
.empty { color: #98a2b3; text-align: center; }
|
||||
footer {
|
||||
display: flex;
|
||||
min-height: 50px;
|
||||
padding: 8px 28px;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex: none;
|
||||
gap: 16px;
|
||||
color: #98a2b3;
|
||||
font-size: 12px;
|
||||
}
|
||||
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 5px; }
|
||||
.page-link {
|
||||
display: inline-flex;
|
||||
min-width: 30px;
|
||||
height: 30px;
|
||||
padding: 0 8px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: 1px solid #d8dee9;
|
||||
border-radius: 6px;
|
||||
color: #344054;
|
||||
background: #fff;
|
||||
text-decoration: none;
|
||||
}
|
||||
.page-link:hover { border-color: #1677ff; color: #1677ff; }
|
||||
.page-link.current { border-color: #1677ff; color: #fff; background: #1677ff; }
|
||||
.page-link.disabled { color: #c3c9d3; background: #f7f8fa; }
|
||||
@media (max-width: 700px) {
|
||||
body { padding: 14px 10px; }
|
||||
header, .toolbar { padding-left: 18px; padding-right: 18px; }
|
||||
header, .toolbar, footer { padding-left: 12px; padding-right: 12px; }
|
||||
.toolbar { align-items: stretch; flex-direction: column; }
|
||||
form { max-width: none; }
|
||||
.count { align-self: flex-end; }
|
||||
footer { align-items: flex-start; flex-direction: column; gap: 5px; }
|
||||
.pagination { width: 100%; justify-content: flex-start; }
|
||||
th, td { padding-left: 8px; padding-right: 8px; }
|
||||
td.action a { padding-left: 6px; padding-right: 6px; }
|
||||
}
|
||||
@media (max-height: 760px) {
|
||||
header { padding-top: 9px; padding-bottom: 8px; }
|
||||
.warning { margin-top: 6px; padding-top: 5px; padding-bottom: 5px; }
|
||||
.toolbar { padding-top: 7px; padding-bottom: 7px; }
|
||||
footer { min-height: 42px; padding-top: 5px; padding-bottom: 5px; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
@@ -113,10 +158,18 @@
|
||||
placeholder="输入用户 ID、账号、姓名或手机号搜索">
|
||||
<button type="submit">搜索用户</button>
|
||||
</form>
|
||||
<div class="count">当前 @@COUNT@@ 条,最多显示 @@MAX_USERS@@ 条</div>
|
||||
<div class="count">共 @@COUNT@@ 个有效账号 · 第 @@CURRENT_PAGE@@ / @@TOTAL_PAGES@@ 页</div>
|
||||
</section>
|
||||
<div class="table-wrap">
|
||||
<table>
|
||||
<colgroup>
|
||||
<col style="width:8%">
|
||||
<col style="width:24%">
|
||||
<col style="width:20%">
|
||||
<col style="width:15%">
|
||||
<col style="width:21%">
|
||||
<col style="width:12%">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>用户 ID</th>
|
||||
@@ -124,13 +177,16 @@
|
||||
<th>姓名</th>
|
||||
<th>手机号</th>
|
||||
<th>用户来源 / 部门</th>
|
||||
<th></th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>@@ROWS@@</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<footer>如列表中没有目标账号,请使用上方搜索框;停用和已删除账号不会显示。</footer>
|
||||
<footer>
|
||||
<span>同一账号只显示最新有效记录;停用、删除和历史重复记录不会显示。最多载入 @@MAX_USERS@@ 个账号。</span>
|
||||
<nav class="pagination" aria-label="用户列表分页">@@PAGINATION@@</nav>
|
||||
</footer>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user