未认证访问登录后误进首页:302 /login 带 next=originalUrl,登录成功/token静默恢复/bfcache僵尸页踢回均按 next 回跳原页(仅认同源/路径,拦//与反斜杠防开放重定向);前端 core/files 的 401 跳登录同样带上当前页
This commit is contained in:
@@ -129,7 +129,8 @@
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
if (res.status === 401) { location.href = '/login'; throw new Error('未登录'); }
|
||||
// 运行中登录态失效:带上当前页 URL,重新登录后原页返回
|
||||
if (res.status === 401) { location.href = '/login?next=' + encodeURIComponent(location.pathname + location.search); throw new Error('未登录'); }
|
||||
if (!res.ok) {
|
||||
let msg = 'HTTP ' + res.status;
|
||||
try { msg = (await res.json()).error || msg; } catch (_) {}
|
||||
|
||||
Reference in New Issue
Block a user