Allow redirecting to a different URL when updating the password. This will be useful for thr Waitlist plugin. (#91)

This commit is contained in:
Giancarlo Buomprisco
2024-12-09 05:56:58 +01:00
committed by GitHub
parent 90f25a5ed5
commit a682b991f3
2 changed files with 11 additions and 3 deletions

View File

@@ -17,12 +17,21 @@ export const generateMetadata = async () => {
const Logo = () => <AppLogo href={''} />;
async function UpdatePasswordPage() {
interface UpdatePasswordPageProps {
searchParams: Promise<{
callback?: string;
}>;
}
async function UpdatePasswordPage(props: UpdatePasswordPageProps) {
await requireUserInServerComponent();
const { callback } = await props.searchParams;
const redirectTo = callback ?? pathsConfig.app.home;
return (
<AuthLayoutShell Logo={Logo}>
<UpdatePasswordForm redirectTo={pathsConfig.app.home} />
<UpdatePasswordForm redirectTo={redirectTo} />
</AuthLayoutShell>
);
}

View File

@@ -74,7 +74,6 @@ class AuthCallbackService {
searchParams.delete('token_hash');
searchParams.delete('type');
searchParams.delete('next');
searchParams.delete('callback');
// if we have a next path, we redirect to that path
if (nextPath) {