Update redirect behavior in auth success state

The commit introduces changes to the behavior of the "Update Password" page on a successful password update. Instead of redirecting the user back to the home page upon a successful update, the updated code now redirects the user to a specified URL passed in as a prop. The authentication configuration has also been updated to include a list of acceptable redirect URLs.
This commit is contained in:
gbuomprisco
2024-06-15 17:37:56 +08:00
parent d3076dfebc
commit 37c8be808d
3 changed files with 12 additions and 10 deletions

View File

@@ -45,11 +45,12 @@ class AuthCallbackService {
const token_hash = searchParams.get('token_hash');
const type = searchParams.get('type') as EmailOtpType | null;
const next = searchParams.get('next') ?? params.redirectPath;
const callbackParam = searchParams.get('callback');
const next = callbackParam ? new URL(callbackParam).pathname : params.redirectPath;
const callbackUrl = callbackParam ? new URL(callbackParam) : null;
const inviteToken = callbackUrl?.searchParams.get('invite_token');
const errorPath = params.errorPath ?? '/auth/callback/error';
// remove the query params from the url