增加登陆后跳转回来源页

This commit is contained in:
virusdefender
2015-08-23 20:37:40 +08:00
parent cc639ed0d1
commit b590ee8577

View File

@@ -14,8 +14,15 @@ require(["jquery", "bsAlert", "csrfToken", "validator"], function ($, bsAlert, c
//成功登陆
var ref = document.referrer;
if(ref){
if(ref.split("/")[2] == location.hostname){
// 注册页和本页的来源的跳转回首页,防止死循环
if(ref.indexOf("register") > -1 || ref.indexOf("login") > -1){
location.href = "/";
return;
}
// 判断来源,只有同域下才跳转
if(ref.split("/")[2].split(":")[0] == location.hostname){
location.href = ref;
return;
}
}
location.href = "/";