From 3d93c30064b76312fc8beb843fbb3a6a6942d5fc Mon Sep 17 00:00:00 2001 From: Aofei Sheng Date: Thu, 17 Oct 2024 09:27:56 +0800 Subject: [PATCH] refactor(sign-in): redirect to intended page after signing in (#990) Fixes #985 Fixes #986 Signed-off-by: Aofei Sheng --- spx-gui/package-lock.json | 22 ++- spx-gui/package.json | 3 +- .../src/components/navbar/NavbarProfile.vue | 2 +- spx-gui/src/main.ts | 2 +- spx-gui/src/pages/editor/index.vue | 2 +- spx-gui/src/pages/sign-in/callback.vue | 9 +- spx-gui/src/stores/user.ts | 147 +++++++++-------- spx-gui/src/utils/casdoor.ts | 150 ------------------ 8 files changed, 104 insertions(+), 233 deletions(-) delete mode 100644 spx-gui/src/utils/casdoor.ts diff --git a/spx-gui/package-lock.json b/spx-gui/package-lock.json index 9c03596b9..fc96986d4 100644 --- a/spx-gui/package-lock.json +++ b/spx-gui/package-lock.json @@ -25,14 +25,15 @@ "@vue/runtime-dom": "^3.4.10", "@vue/test-utils": "^2.4.5", "@vue/tsconfig": "^0.5.1", + "casdoor-js-sdk": "^0.15.0", "dayjs": "^1.11.10", "eslint": "^8.56.0", "eslint-plugin-vue": "^9.20.1", "file-saver": "^2.0.5", "happy-dom": "^14.3.6", "install": "^0.13.0", - "js-pkce": "^1.4.0", "jszip": "^3.10.1", + "jwt-decode": "^4.0.0", "konva": "^9.3.1", "localforage": "^1.10.0", "lodash": "^4.17.21", @@ -4258,6 +4259,16 @@ } ] }, + "node_modules/casdoor-js-sdk": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/casdoor-js-sdk/-/casdoor-js-sdk-0.15.0.tgz", + "integrity": "sha512-hVQLnWLGnRd1ve4TqIidA8/LRoSDZb69u2JNsD6dXil+Xs68aHZgguqXLM7nE85/0YE0DOr2fSJgBRSgH9R7ug==", + "license": "Apache-2.0", + "dependencies": { + "js-pkce": "^1.3.0", + "jwt-decode": "^4.0.0" + } + }, "node_modules/ccount": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", @@ -6537,6 +6548,15 @@ "integrity": "sha512-silMIRiFjUWlfaDhkgSzpuAyQ6EX/o09Eu8ZBfmFwQMbax7+LQzeIU2CBrICT6Ne4l86ITCGvUCBpCubWYy0Yw==", "license": "MIT" }, + "node_modules/jwt-decode": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jwt-decode/-/jwt-decode-4.0.0.tgz", + "integrity": "sha512-+KJGIyHgkGuIq3IEBNftfhW/LfWhXUIY6OmyVWjliu5KH1y0fw7VQ8YndE2O4qZdMSd9SqbnC8GOcZEy0Om7sA==", + "license": "MIT", + "engines": { + "node": ">=18" + } + }, "node_modules/keyv": { "version": "4.5.4", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", diff --git a/spx-gui/package.json b/spx-gui/package.json index 76627abe6..6f331aa77 100644 --- a/spx-gui/package.json +++ b/spx-gui/package.json @@ -30,14 +30,15 @@ "@vue/runtime-dom": "^3.4.10", "@vue/test-utils": "^2.4.5", "@vue/tsconfig": "^0.5.1", + "casdoor-js-sdk": "^0.15.0", "dayjs": "^1.11.10", "eslint": "^8.56.0", "eslint-plugin-vue": "^9.20.1", "file-saver": "^2.0.5", "happy-dom": "^14.3.6", "install": "^0.13.0", - "js-pkce": "^1.4.0", "jszip": "^3.10.1", + "jwt-decode": "^4.0.0", "konva": "^9.3.1", "localforage": "^1.10.0", "lodash": "^4.17.21", diff --git a/spx-gui/src/components/navbar/NavbarProfile.vue b/spx-gui/src/components/navbar/NavbarProfile.vue index d5de75528..ac6def268 100644 --- a/spx-gui/src/components/navbar/NavbarProfile.vue +++ b/spx-gui/src/components/navbar/NavbarProfile.vue @@ -1,6 +1,6 @@