feat: implement validateRedirect utility for open redirect protection
This commit is contained in:
@@ -24,14 +24,14 @@ definePageMeta({
|
||||
});
|
||||
|
||||
const route = useRoute();
|
||||
const redirectPath = (route.query.redirect as string) || '/dashboard';
|
||||
const redirectPath = validateRedirect(route.query.redirect, '/dashboard');
|
||||
const { authProviders, error, isAuthenticated } = useAuth();
|
||||
|
||||
const providers = await authProviders();
|
||||
|
||||
watch(isAuthenticated, (authenticated) => {
|
||||
const redirect = (authenticated: boolean) => {
|
||||
if (authenticated) {
|
||||
navigateTo(redirectPath);
|
||||
}
|
||||
});
|
||||
};
|
||||
redirect(isAuthenticated.value);
|
||||
watch(isAuthenticated, redirect);
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user