Ver código fonte

Merge remote-tracking branch 'remotes/origin/hotfixes_v5.0.6_20250609_cas_auth' into dev_v5.0.6

xiatian 1 semana atrás
pai
commit
f660b66b8b

+ 4 - 0
src/modules/portal/views/Access.vue

@@ -29,6 +29,8 @@ export default {
     this.accessInfo.appId = params.appId;
     this.accessInfo.timestamp = params.timestamp;
     this.accessInfo.token = params.token;
+    this.accessInfo.from = params.from;
+    this.accessInfo.scode = params.scode;
 
     const url = CORE_API + "/auth/thirdPartyAccess";
     this.$httpWithMsg
@@ -37,6 +39,8 @@ export default {
       })
       .then((response) => {
         var user = response.data;
+        user.from = this.accessInfo.from;
+        user.scode = this.accessInfo.scode;
         this.USER_SIGNIN(user);
         this.$router.replace({ path: "/home/overview" });
         this.$notify({

+ 52 - 29
src/modules/portal/views/home/Home.vue

@@ -347,38 +347,61 @@ export default {
       this.$refs.passForm.resetFields();
     },
     logout() {
-      const orgId = this.user.rootOrgId;
-      const getRootOrgId = () => {
-        if (location.hostname.includes("qmth.com.cn")) {
-          return "";
-        } else {
-          return "?orgId=" + orgId;
-        }
-      };
-
-      this.$http
-        .post(CORE_API + "/auth/logout")
-        .then(() => {
-          this.USER_SIGNOUT();
-          window.name = "";
-          this.$router.replace({
-            path: "/login" + getRootOrgId(),
+      if ("cas" == this.user.from) {
+        this.$http
+          .get("/api/auth/logout/" + this.user.scode)
+          .then((response) => {
+            const link = document.createElement("a");
+            link.href = response.data.url;
+            link.rel = "noopener noreferrer";
+            document.body.appendChild(link);
+            link.click();
+            this.USER_SIGNOUT();
+          })
+          .catch((response) => {
+            if (response.status == 500) {
+              this.$notify({
+                showClose: true,
+                message: response.data.desc,
+                type: "error",
+              });
+            }
+            this.USER_SIGNOUT();
           });
-        })
-        .catch((response) => {
-          if (response.status == 500) {
-            this.$notify({
-              showClose: true,
-              message: response.data.desc,
-              type: "error",
-            });
+      } else {
+        const orgId = this.user.rootOrgId;
+        const getRootOrgId = () => {
+          if (location.hostname.includes("qmth.com.cn")) {
+            return "";
+          } else {
+            return "?orgId=" + orgId;
           }
-          this.USER_SIGNOUT();
-          window.name = "";
-          this.$router.replace({
-            path: "/login" + getRootOrgId(),
+        };
+
+        this.$http
+          .post(CORE_API + "/auth/logout")
+          .then(() => {
+            this.USER_SIGNOUT();
+            window.name = "";
+            this.$router.replace({
+              path: "/login" + getRootOrgId(),
+            });
+          })
+          .catch((response) => {
+            if (response.status == 500) {
+              this.$notify({
+                showClose: true,
+                message: response.data.desc,
+                type: "error",
+              });
+            }
+            this.USER_SIGNOUT();
+            window.name = "";
+            this.$router.replace({
+              path: "/login" + getRootOrgId(),
+            });
           });
-        });
+      }
     },
   },
 };