瀏覽代碼

王子文 Azure授权登录

wangggziwen 2 年之前
父節點
當前提交
e09248525e

+ 1 - 1
master/src/main/java/com/ruoyi/project/system/controller/SysLoginController.java

@@ -98,7 +98,7 @@ public class SysLoginController {
     }
 
     /**
-     * 登录方法
+     * Azure登录方法
      *
      * @param loginBody 登录信息
      * @return 结果

+ 4 - 9
ui/src/views/azureLogin.vue

@@ -24,15 +24,11 @@ export default {
       loading: false,
     };
   },
-
   created() {
-    let code = this.$route.query.code
-    if (!code) {
-      code = window.location.search.replace("?code=" , '')
-    }
-    this.code = code
-    console.log(this.code)
-    this.getAzureAccessToken()
+    this.code = window.location.search.replace("?code=" , '');
+    this.code = this.code.substring(0, this.code.indexOf("&"));
+    console.log(this.code);
+    this.getAzureAccessToken();
   },
   methods: {
     getAzureAccessToken(){
@@ -40,7 +36,6 @@ export default {
         this.msgSuccess(this.$t('成功'));
       });
     }
-
   }
 };
 </script>

+ 6 - 0
ui/src/views/login.vue

@@ -122,6 +122,12 @@ export default {
     }
   },
   created() {
+    let code = window.location.search.replace("?code=" , '');
+    if (code) {
+      code = code.substring(0, code.indexOf("&"));
+      console.log(code)
+      window.location.href = '#/azureLogin?code='+code;
+    }
     this.getCode();
     this.getCookie();
     if (!this.$store.getters.language){