feat: xavis ai_platform 기능 이전 및 ncue 환경 전환
xavis 소스·DB 스키마·활용사례/F-Scan/프롬프트 라이브러리 등 기능 반영. @xavis.co.kr → @ncue.net, 관리자 토큰 ncue-admin, 런타임 data/ Git 추적 제외. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -18,8 +18,12 @@
|
||||
<main class="container">
|
||||
<section class="panel">
|
||||
<p class="subtitle" style="margin-bottom: 16px">
|
||||
OPS 이메일(<strong>@xavis.co.kr</strong>) 매직 링크로 <strong>로그인에 성공한</strong> 사용자 목록입니다. 이메일과 최근 접속일(마지막 로그인 시각)을 표시합니다.
|
||||
OPS 이메일(<strong>@ncue.net</strong>) 매직 링크로 <strong>로그인에 성공한</strong> 사용자 목록입니다. 이메일과 최근 접속일(마지막 로그인 시각)을 표시합니다.
|
||||
</p>
|
||||
<p class="admin-hint" style="margin-bottom: 16px">
|
||||
<strong>전체 로그아웃</strong>을 실행하면 해당 사용자의 모든 디바이스에서 OPS 세션이 즉시 무효화됩니다. 이후 다시 매직 링크로 로그인해야 합니다.
|
||||
</p>
|
||||
<p id="adminUsersFlash" class="form-message" hidden role="status"></p>
|
||||
<% if (typeof dbError !== 'undefined' && dbError) { %>
|
||||
<p class="admin-error">목록을 불러오지 못했습니다: <%= dbError %></p>
|
||||
<% } else if (!pgConnected) { %>
|
||||
@@ -33,11 +37,13 @@
|
||||
<tr>
|
||||
<th scope="col">이메일</th>
|
||||
<th scope="col">최근 접속일</th>
|
||||
<th scope="col">세션 무효화</th>
|
||||
<th scope="col">작업</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% users.forEach(function (u) { %>
|
||||
<tr>
|
||||
<tr data-email="<%= u.email %>">
|
||||
<td><%= u.email %></td>
|
||||
<td>
|
||||
<% if (u.lastLoginAt) { %>
|
||||
@@ -46,6 +52,22 @@
|
||||
—
|
||||
<% } %>
|
||||
</td>
|
||||
<td class="js-sessions-revoked-at">
|
||||
<% if (u.sessionsRevokedAt) { %>
|
||||
<%= new Date(u.sessionsRevokedAt).toLocaleString('ko-KR', { timeZone: 'Asia/Seoul' }) %>
|
||||
<% } else { %>
|
||||
—
|
||||
<% } %>
|
||||
</td>
|
||||
<td>
|
||||
<button
|
||||
type="button"
|
||||
class="danger btn-sm js-revoke-sessions-btn"
|
||||
data-email="<%= u.email %>"
|
||||
>
|
||||
전체 로그아웃
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
<% }); %>
|
||||
</tbody>
|
||||
@@ -57,5 +79,54 @@
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
(function () {
|
||||
const flash = document.getElementById("adminUsersFlash");
|
||||
function showFlash(text, isError) {
|
||||
if (!flash) return;
|
||||
flash.textContent = text;
|
||||
flash.hidden = false;
|
||||
flash.style.color = isError ? "#b91c1c" : "#059669";
|
||||
}
|
||||
|
||||
document.querySelectorAll(".js-revoke-sessions-btn").forEach(function (btn) {
|
||||
btn.addEventListener("click", async function () {
|
||||
const email = btn.getAttribute("data-email") || "";
|
||||
if (!email) return;
|
||||
const ok = window.confirm(
|
||||
email + " 사용자의 모든 디바이스에서 OPS 세션을 만료(전체 로그아웃)시키겠습니까?"
|
||||
);
|
||||
if (!ok) return;
|
||||
|
||||
btn.disabled = true;
|
||||
try {
|
||||
const res = await fetch("/api/admin/users/revoke-sessions", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ email: email }),
|
||||
});
|
||||
const data = await res.json().catch(function () {
|
||||
return {};
|
||||
});
|
||||
if (!res.ok) {
|
||||
throw new Error(data.error || "요청 실패");
|
||||
}
|
||||
const row = btn.closest("tr");
|
||||
const cell = row && row.querySelector(".js-sessions-revoked-at");
|
||||
if (cell && data.revokedAt) {
|
||||
cell.textContent = new Date(data.revokedAt).toLocaleString("ko-KR", {
|
||||
timeZone: "Asia/Seoul",
|
||||
});
|
||||
}
|
||||
showFlash(email + " 사용자의 세션이 무효화되었습니다.");
|
||||
} catch (err) {
|
||||
showFlash(err.message || "세션 만료 처리 실패", true);
|
||||
} finally {
|
||||
btn.disabled = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user