mirror of
https://github.com/directus/directus.git
synced 2026-04-03 03:00:39 -04:00
O auth login is ignoring the redirect url (#17939)
* link redirect param to continue param of oauth * redirect to the link of continue param * add github username to contributors.yml * save the file to run lint stage * Resolve redirect on continue-as; fix redirect query param * Clean up names --------- Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
This commit is contained in:
@@ -71,7 +71,8 @@ export default defineComponent({
|
||||
|
||||
async function hydrateAndLogin() {
|
||||
await hydrate();
|
||||
router.push(lastPage.value || `/content`);
|
||||
const redirectQuery = router.currentRoute.value.query.redirect as string;
|
||||
router.push(redirectQuery || lastPage.value || `/content`);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -49,15 +49,22 @@ export default defineComponent({
|
||||
() => {
|
||||
ssoProviders.value = providers.value
|
||||
.filter((provider: AuthProvider) => AUTH_SSO_DRIVERS.includes(provider.driver))
|
||||
.map((provider: AuthProvider) => ({
|
||||
name: provider.name,
|
||||
label: provider.label || formatTitle(provider.name),
|
||||
link: `${getRootPath()}auth/login/${provider.name}?redirect=${window.location.href.replace(
|
||||
location.search,
|
||||
''
|
||||
)}?continue`,
|
||||
icon: provider.icon ?? 'account_circle',
|
||||
}));
|
||||
.map((provider: AuthProvider) => {
|
||||
const ssoLoginLink = new URL(window.location.origin);
|
||||
ssoLoginLink.pathname = `${getRootPath()}auth/login/${provider.name}`;
|
||||
|
||||
const redirectToLink = new URL(window.location.href);
|
||||
redirectToLink.searchParams.set('continue', '');
|
||||
|
||||
ssoLoginLink.searchParams.set('redirect', redirectToLink.toString());
|
||||
|
||||
return {
|
||||
name: provider.name,
|
||||
label: provider.label || formatTitle(provider.name),
|
||||
link: ssoLoginLink.toString(),
|
||||
icon: provider.icon ?? 'account_circle',
|
||||
};
|
||||
});
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user