fix: 修复登录重定向失效 + 404页面友好化
- ShowPage 未登录用户看未发布帖子时引导登录(携带 redirect 参数),替代直接 404 - login.js 无 redirect 参数时回退到同站 Referer 页面 - 404 页面重设计:SVG 图标 + 中文提示 + 返回首页和浏览帖子双按钮 - posts.css 新增 404 页面按钮样式
This commit is contained in:
@ -19,6 +19,19 @@
|
||||
function getRedirect() {
|
||||
var m = window.location.search.match(/[?&]redirect=([^&]+)/);
|
||||
if (m) return decodeURIComponent(m[1]);
|
||||
// 回退:如果来源页是本站页面,跳回来源页
|
||||
try {
|
||||
var ref = document.referrer;
|
||||
if (ref) {
|
||||
var a = document.createElement('a');
|
||||
a.href = ref;
|
||||
if (a.hostname === window.location.hostname &&
|
||||
a.pathname !== window.location.pathname &&
|
||||
a.pathname.indexOf('/auth/') !== 0) {
|
||||
return a.pathname + a.search + a.hash;
|
||||
}
|
||||
}
|
||||
} catch (e) {}
|
||||
return '/';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user