Browse Source

Changed on Login Stuff and visibility control.

jason.lu 6 years ago
parent
commit
c6dd930b4d
1 changed files with 12 additions and 15 deletions
  1. 12 15
      js/basic.js

+ 12 - 15
js/basic.js

@@ -374,23 +374,20 @@ function getCookie(c_name)
 
 function getUserId() {
     var use = getCookie("doibyUser");
-    if (use == null) {
-        location.href = "sign-in1.html?from=entrance-1&msg=nologin";
-        if (userId == null) {
-            userId = use;
-        } else {
-            // 指定新的userId
-            //userId = use;
-        }
+    if (use == null || use === undefined || use.length <= 0) {
+        location.href = "sign-in1.html?from=entrance-1&msg=nologin-mustauth";
+        return;
+    }
+
+    try{
+        var mm = parseInt(use);
+    }catch (e) {
+        location.href = "sign-in1.html?from=entrance-1&msg=cookie-wrong-format";
+        return;
     }
+
     if(userId == null || userId === undefined){
-        location.href = "sign-in1.html?from=entrance-3&msg=from-cookie-userId-repeated-notdefined";
-    }else{
-        if(parseInt(userId) <= 0){
-            location.href = "sign-in1.html?from=entrance-4&msg=from-cookie-parseOut0";
-        }else{
-            location.href = "sign-in1.html?from=entrance-4&msg=must-auth";
-        }
+        userId = parseInt(use);
     }
 }