mirror of
https://gitcode.com/JianFeeeee/TrulyMEM-TrueHumanMEM.git
synced 2026-09-20 08:58:15 +00:00
fix: 登录问题修复 - session cookie配置 + 前端调试日志 + 力导向图布局优化
- 显式配置 session cookie (HTTPOnly/SameSite/Secure/Name) - 前端 fetch 增加 credentials: same-origin - 登录成功后备 cookie 设置 - 服务端 api_login 增加调试日志 - 星图布局基于 mention_count 优化节点间距 - 保留旧数据库数据
This commit is contained in:
@ -200,23 +200,33 @@
|
||||
loginBtn.disabled = true;
|
||||
|
||||
try {
|
||||
console.log('[DEBUG] Sending login request for:', username);
|
||||
const response = await fetch('/api/login', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({ username, password })
|
||||
body: JSON.stringify({ username, password }),
|
||||
credentials: 'same-origin'
|
||||
});
|
||||
console.log('[DEBUG] Response status:', response.status);
|
||||
console.log('[DEBUG] Response headers:', [...response.headers.entries()]);
|
||||
|
||||
const data = await response.json();
|
||||
console.log('[DEBUG] Response data:', data);
|
||||
|
||||
if (data.success) {
|
||||
console.log('[DEBUG] Login success, setting cookie manually and redirecting...');
|
||||
// 手动设置 cookie 作为后备
|
||||
document.cookie = 'trulymem_session=1; path=/; SameSite=Lax';
|
||||
window.location.href = '/graph.html';
|
||||
} else {
|
||||
console.log('[DEBUG] Login failed:', data.error);
|
||||
errorMsg.textContent = data.error || '登录失败';
|
||||
errorMsg.classList.add('show');
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('[DEBUG] Network error:', err);
|
||||
errorMsg.textContent = '网络错误,请重试';
|
||||
errorMsg.classList.add('show');
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user