Skip to content

Commit

Permalink
[release-4.1] fix: clear authAuthorizeUrl cookie when redirecting to …
Browse files Browse the repository at this point in the history
…login (#4341)

fix: clear authAuthorizeUrl cookie when redirecting to login

Signed-off-by: yazhou <[email protected]>
Co-authored-by: yazhou <[email protected]>
  • Loading branch information
ks-ci-bot and yazhouio authored Nov 13, 2024
1 parent 9daaebf commit 2a5ada6
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 2a5ada6

Please sign in to comment.