Kaynağa Gözat

错误处理

jason.lu 6 yıl önce
ebeveyn
işleme
5484d6d60e
1 değiştirilmiş dosya ile 13 ekleme ve 1 silme
  1. 13 1
      js/basic.js

+ 13 - 1
js/basic.js

@@ -141,11 +141,24 @@ function on_gp_success(a,b) {
 }
 }
 
 
 function on_dat_success(a,b){
 function on_dat_success(a,b){
+    if(check_if_authfail(a,b)){
+        location.href = "sign-in1.html?from=entrance-1&msg=server-redirect-detected";
+        return;
+    }
     if(check_if_success(a,b)) {
     if(check_if_success(a,b)) {
         this.callme(a,b);
         this.callme(a,b);
     }
     }
 }
 }
 
 
+function check_if_authfail(a){
+    if(a == null || typeof a !== "string"){
+        if(a.indexOf("login?from=") > 0 || a.startsWith("<!DOCTYPE html>") || a.indexOf("<!-- SME::LOGINPAGE -->") > 0){
+            return true;
+        }
+    }
+    return false;
+}
+
 function check_if_success(a,b){
 function check_if_success(a,b){
     if(typeof a === "string"){
     if(typeof a === "string"){
         try {
         try {
@@ -410,7 +423,6 @@ function getUserId() {
     try{
     try{
         var mm = parseInt(use);
         var mm = parseInt(use);
         if(mm <= 0){
         if(mm <= 0){
-            location.href = "sign-in1.html?from=entrance-1&msg=cookie-wrong-format";
         }else{
         }else{
             userId = mm;
             userId = mm;
         }
         }