chore: backend redirection

This commit is contained in:
gurusainath 2024-05-01 17:50:21 +05:30
parent d26c2fd6de
commit 75f6f643ac
2 changed files with 11 additions and 1 deletions

View File

@ -52,6 +52,7 @@ export const InstanceWrapper: FC<TInstanceWrapper> = observer((props) => {
); );
if (instance?.instance?.is_setup_done && pageType === EInstancePageType.PRE_SETUP) redirect("/"); if (instance?.instance?.is_setup_done && pageType === EInstancePageType.PRE_SETUP) redirect("/");
if (!instance?.instance?.is_setup_done && pageType === EInstancePageType.POST_SETUP) redirect("/setup"); if (!instance?.instance?.is_setup_done && pageType === EInstancePageType.POST_SETUP) redirect("/setup");
return <>{children}</>; return <>{children}</>;

View File

@ -122,9 +122,18 @@ class MagicSignInSpaceEndpoint(View):
# Login the user and record his device info # Login the user and record his device info
user_login(request=request, user=user) user_login(request=request, user=user)
# redirect to referer path # redirect to referer path
if user.is_password_autoset and profile.is_onboarded:
path = "spaces/accounts/set-password"
else:
# Get the redirection path
path = (
str(next_path)
if next_path
else "spaces"
)
url = urljoin( url = urljoin(
base_host(request=request), base_host(request=request),
str(next_path) if next_path else "spaces", path
) )
return HttpResponseRedirect(url) return HttpResponseRedirect(url)