Merge "Fix auth redirect problem when root url is accessed"

This commit is contained in:
Zuul 2025-01-30 01:54:53 +00:00 committed by Gerrit Code Review
commit 57fc87055a

View File

@ -143,7 +143,9 @@ class App extends React.Component {
if (auth.info.read_protected && !user.data) {
console.log('Read-access login required')
const redirect_target = window.location.href.slice(getHomepageUrl().length)
localStorage.setItem('zuul_auth_redirect', redirect_target)
// If the redirect_target is the root url, we set the zuul_auth_redirect to /
// so that the auth callback page can redirect to the / after login
localStorage.setItem('zuul_auth_redirect', redirect_target==='' ? '/' : redirect_target)
this.props.signIn()
return <Fetching />
}