From c1ad8a01218d49504bc2ad8cb0364fe49b4192ad Mon Sep 17 00:00:00 2001 From: Victor_Jay Date: Tue, 2 Jun 2026 15:17:35 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=B8=96=E5=AD=90?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B56=E5=A4=84=20/login=20=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - posts/show.html 中所有 /login 跳转改为 /auth/login - 覆盖评论登录提示、点赞/反对/收藏 401 跳转 --- templates/MetaLab-2026/html/posts/show.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/templates/MetaLab-2026/html/posts/show.html b/templates/MetaLab-2026/html/posts/show.html index 4ae8560..36e6262 100644 --- a/templates/MetaLab-2026/html/posts/show.html +++ b/templates/MetaLab-2026/html/posts/show.html @@ -126,7 +126,7 @@ {{else}}
- 登录 后参与评论 + 登录 后参与评论
{{end}} @@ -324,7 +324,7 @@ headers: { 'Content-Type': 'application/json', 'X-CSRF-Token': csrfToken } }) .then(function(r) { - if (r.status === 401) { window.location.href = '/login?redirect=/posts/' + postId; return null; } + if (r.status === 401) { window.location.href = '/auth/login?redirect=/posts/' + postId; return null; } return r.json(); }) .then(function(d) { @@ -346,7 +346,7 @@ headers: { 'Content-Type': 'application/json', 'X-CSRF-Token': csrfToken } }) .then(function(r) { - if (r.status === 401) { window.location.href = '/login?redirect=/posts/' + postId; return null; } + if (r.status === 401) { window.location.href = '/auth/login?redirect=/posts/' + postId; return null; } return r.json(); }) .then(function(d) { @@ -388,7 +388,7 @@ if (csrfToken) opts.headers['X-CSRF-Token'] = csrfToken; if (data) opts.body = JSON.stringify(data); return fetch(url, opts).then(function(r) { - if (r.status === 401) { window.location.href = '/login?redirect=/posts/' + postId; throw new Error('unauthorized'); } + if (r.status === 401) { window.location.href = '/auth/login?redirect=/posts/' + postId; throw new Error('unauthorized'); } return r.json(); }); } @@ -470,7 +470,7 @@ // 无弹窗回退(未登录跳转) function handleNoModal() { if (!csrfToken) { - window.location.href = '/login?redirect=/posts/' + postId; + window.location.href = '/auth/login?redirect=/posts/' + postId; return; } // 无弹窗兜底:直接 toggle @@ -571,7 +571,7 @@ // 事件:点击收藏按钮 → 打开弹窗 favBtn.addEventListener('click', function() { - if (!csrfToken) { window.location.href = '/login?redirect=/posts/' + postId; return; } + if (!csrfToken) { window.location.href = '/auth/login?redirect=/posts/' + postId; return; } showModal(); });