Skip to content

Commit

Permalink
fix: clear authAuthorizeUrl cookie when redirecting to login (#4340)
Browse files Browse the repository at this point in the history
Signed-off-by: yazhou <[email protected]>
  • Loading branch information
yazhouio authored Nov 13, 2024
1 parent ccb1016 commit 3eeabe8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions server/controllers/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ const handleLogin = async ctx => {
}

if (authAuthorizeUrl) {
ctx.cookies.set('authAuthorizeUrl', null);
ctx.body = {
success: true,
redirect: authAuthorizeUrl,
Expand Down
5 changes: 4 additions & 1 deletion server/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,10 @@ const oauthProxy = {
target,
changeOrigin: true,
optionsHandle(options, req, ctx) {
ctx.cookies.set('authAuthorizeUrl', req.url);
// if not login, redirect to login page
if (!ct.cookies.get('token')) {
ctx.cookies.set('authAuthorizeUrl', req.url);
}
},
events: {
proxyReq(proxyReq, req) {
Expand Down

0 comments on commit 3eeabe8

Please sign in to comment.