101 lines
3.0 KiB
HTML
101 lines
3.0 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>DeepData 登录中…</title>
|
|
<style>
|
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
body {
|
|
min-height: 100vh;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
|
|
background: linear-gradient(135deg, #eff6ff 0%, #eef2ff 100%);
|
|
}
|
|
.card {
|
|
background: #fff;
|
|
border-radius: 16px;
|
|
box-shadow: 0 10px 30px rgba(37, 99, 235, 0.12);
|
|
padding: 40px 48px;
|
|
max-width: 420px;
|
|
width: 90%;
|
|
text-align: center;
|
|
}
|
|
.spinner {
|
|
width: 32px; height: 32px;
|
|
margin: 0 auto 16px;
|
|
border: 3px solid #dbeafe;
|
|
border-top-color: #2563eb;
|
|
border-radius: 50%;
|
|
animation: spin 0.8s linear infinite;
|
|
}
|
|
@keyframes spin { to { transform: rotate(360deg); } }
|
|
h1 { font-size: 18px; color: #1f2937; margin-bottom: 8px; }
|
|
p { font-size: 14px; color: #6b7280; }
|
|
.error { color: #dc2626; }
|
|
a { color: #2563eb; text-decoration: none; }
|
|
a:hover { text-decoration: underline; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="card">
|
|
<div id="spinner" class="spinner"></div>
|
|
<h1 id="title">DeepData 登录处理中…</h1>
|
|
<p id="desc">正在完成单点登录,请稍候。</p>
|
|
</div>
|
|
<script>
|
|
(function () {
|
|
var params = new URLSearchParams(window.location.search);
|
|
var token = params.get("sso_token");
|
|
var logout = params.get("sso_logout");
|
|
var error = params.get("sso_error");
|
|
var errDesc = params.get("sso_error_description") || "";
|
|
|
|
var title = document.getElementById("title");
|
|
var desc = document.getElementById("desc");
|
|
var spinner = document.getElementById("spinner");
|
|
|
|
function fail(msg) {
|
|
spinner.style.display = "none";
|
|
title.textContent = "登录失败";
|
|
title.className = "error";
|
|
desc.innerHTML = (msg ? msg + "<br/>" : "") +
|
|
'<a href="/#/">返回首页</a>';
|
|
}
|
|
|
|
if (error) {
|
|
fail(decodeURIComponent(errDesc || "单点登录未完成,请重试"));
|
|
return;
|
|
}
|
|
|
|
if (logout) {
|
|
// 登出回调:清理本地会话
|
|
try { localStorage.removeItem("session"); } catch (e) {}
|
|
window.location.replace("/#/");
|
|
return;
|
|
}
|
|
|
|
if (token) {
|
|
try {
|
|
// SSO 登录成功:持久化会话(与账号密码登录的 localStorage.session 结构一致)
|
|
localStorage.setItem("session", JSON.stringify({
|
|
token: token,
|
|
authMode: "SSO"
|
|
}));
|
|
} catch (e) {
|
|
fail("保存登录状态失败,请检查浏览器是否允许本地存储");
|
|
return;
|
|
}
|
|
window.location.replace("/#/");
|
|
return;
|
|
}
|
|
|
|
// 缺少任何参数:视为异常
|
|
fail("未收到有效的登录结果");
|
|
})();
|
|
</script>
|
|
</body>
|
|
</html>
|