diff --git a/backend/src/main/java/io/dataease/plugins/server/XDingtalkServer.java b/backend/src/main/java/io/dataease/plugins/server/XDingtalkServer.java index 92c6c192a2..8ef0b84ecb 100644 --- a/backend/src/main/java/io/dataease/plugins/server/XDingtalkServer.java +++ b/backend/src/main/java/io/dataease/plugins/server/XDingtalkServer.java @@ -80,8 +80,7 @@ public class XDingtalkServer { return dingtalkXpackService.getQrParam(); } - @GetMapping("/callBack") - public ModelAndView callBack(@RequestParam("code") String code, @RequestParam("state") String state) { + private ModelAndView privateCallBack(String code, Boolean withoutLogin) { ModelAndView modelAndView = new ModelAndView("redirect:/"); HttpServletResponse response = ServletUtils.response(); DingtalkXpackService dingtalkXpackService = null; @@ -95,7 +94,7 @@ public class XDingtalkServer { if (!isOpen) { DEException.throwException("未开启钉钉"); } - DingUserEntity dingUserEntity = dingtalkXpackService.userInfo(code); + DingUserEntity dingUserEntity = withoutLogin ? dingtalkXpackService.userInfoWithoutLogin(code) : dingtalkXpackService.userInfo(code); String username = dingUserEntity.getUserid(); SysUserEntity sysUserEntity = authUserService.getUserByDingtalkId(username); if (null == sysUserEntity) { @@ -139,6 +138,16 @@ public class XDingtalkServer { return modelAndView; } + @GetMapping("/callBackWithoutLogin") + public ModelAndView callBackWithoutLogin(@RequestParam("code") String code) { + return privateCallBack(code, true); + } + + @GetMapping("/callBack") + public ModelAndView callBack(@RequestParam("code") String code, @RequestParam("state") String state) { + return privateCallBack(code, false); + } + private void bindError(HttpServletResponse response, String url, String errorMsg) { Cookie cookie_error = new Cookie("DingtalkError", errorMsg); cookie_error.setPath("/"); diff --git a/frontend/src/permission.js b/frontend/src/permission.js index 990658e5ef..e490e0a576 100644 --- a/frontend/src/permission.js +++ b/frontend/src/permission.js @@ -26,7 +26,7 @@ NProgress.configure({ showSpinner: false }) // NProgress Configuration -const whiteList = ['/login', '/401', '/404', '/delink', '/nolic'] // no redirect whitelist +const whiteList = ['/login', '/401', '/404', '/delink', '/nolic', '/de-auto-login'] // no redirect whitelist const routeBefore = (callBack) => { let uiInfo = getSysUI() @@ -53,7 +53,7 @@ const routeBefore = (callBack) => { callBack() } } -router.beforeEach(async(to, from, next) => routeBefore(() => { +router.beforeEach(async (to, from, next) => routeBefore(() => { // start progress bar NProgress.start() const mobileIgnores = ['/delink'] diff --git a/frontend/src/router/index.js b/frontend/src/router/index.js index c63d5842b9..757a70155e 100644 --- a/frontend/src/router/index.js +++ b/frontend/src/router/index.js @@ -91,6 +91,11 @@ export const constantRoutes = [ path: '/previewFullScreen', component: () => import('@/components/canvas/components/editor/PreviewFullScreen'), hidden: true + }, + { + path: '/de-auto-login', + component: () => import('@/views/DeAutoLogin'), + hidden: true } // { @@ -208,11 +213,11 @@ export const constantRoutes = [ // ] // }, // 404 page must be placed at the end !!! -// { path: '*', redirect: '/404', hidden: true } + // { path: '*', redirect: '/404', hidden: true } ] const createRouter = () => new Router({ -// mode: 'history', // require service support + // mode: 'history', // require service support mode: 'hash', scrollBehavior: () => ({ y: 0 }), routes: constantRoutes diff --git a/frontend/src/store/modules/permission.js b/frontend/src/store/modules/permission.js index cb1cfd889a..03575aaa96 100644 --- a/frontend/src/store/modules/permission.js +++ b/frontend/src/store/modules/permission.js @@ -29,7 +29,7 @@ const actions = { commit('SET_CURRENT_PATH', path) } } -export const fullScreenRouters = ['XpackThemeForm', 'system/datasource/DsForm', 'dataset/Form'] +export const fullScreenRouters = ['XpackThemeForm', 'system/datasource/DsForm', 'dataset/Form', 'DeAutoLogin'] export const filterAsyncRouter = (routers) => { // 遍历后台传来的路由字符串,转换为组件对象 return routers.map(router => { if (!fullScreenRouters.includes(router.component) && router.type === 1 && router.pid === 0 && router.component && router.component !== 'Layout') { diff --git a/frontend/src/views/DeAutoLogin.vue b/frontend/src/views/DeAutoLogin.vue new file mode 100644 index 0000000000..9dce10e49a --- /dev/null +++ b/frontend/src/views/DeAutoLogin.vue @@ -0,0 +1,68 @@ + + + + +