钉钉登录确认会话后再跳转
This commit is contained in:
parent
a13a6cc180
commit
8b2ec847e7
@ -118,6 +118,7 @@ export default function Page() {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
"X-Auth-Return-Redirect": "1",
|
||||
},
|
||||
body: new URLSearchParams({
|
||||
csrfToken,
|
||||
|
||||
@ -143,7 +143,7 @@
|
||||
<div class="brand-mark">AI</div>
|
||||
<div class="loading-spinner"></div>
|
||||
<p id="statusText" class="status-text">正在登录...</p>
|
||||
<p class="hint-text">正在通过钉钉确认企业身份,完成后会自动回到工作台。</p>
|
||||
<p class="hint-text">正在通过钉钉确认企业身份,完成后会自动返回原页面。</p>
|
||||
<div class="status-row">
|
||||
<span class="status-dot"></span>
|
||||
安全连接已建立
|
||||
@ -215,7 +215,7 @@
|
||||
if (typeof callbackUrl !== 'string' || !callbackUrl) return '/';
|
||||
try {
|
||||
const parsed = new URL(callbackUrl, window.location.origin);
|
||||
if (parsed.origin !== window.location.origin) return '/';
|
||||
if (parsed.origin !== window.location.origin || parsed.pathname.startsWith('//')) return '/';
|
||||
return parsed.pathname + parsed.search + parsed.hash;
|
||||
} catch (error) {
|
||||
return '/';
|
||||
@ -238,6 +238,7 @@
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'X-Auth-Return-Redirect': '1',
|
||||
},
|
||||
body: new URLSearchParams({
|
||||
csrfToken: csrfToken,
|
||||
@ -251,7 +252,7 @@
|
||||
|
||||
if (loginRes.ok || loginRes.redirected) {
|
||||
statusText.textContent = '登录成功,正在跳转...';
|
||||
console.log('[DingTalk Callback] Login successful, redirecting to home...');
|
||||
console.log('[DingTalk Callback] Login successful, validating session...');
|
||||
|
||||
// 等待更长时间确保 cookie 被设置并同步
|
||||
await new Promise(resolve => setTimeout(resolve, 800));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user