fix: login domain redirect blocking to application (#40017)

## Description
> [!TIP]  
> _Add a TL;DR when the description is longer than 500 words or
extremely technical (helps the content, marketing, and DevRel team)._
>
> _Please also include relevant motivation and context. List any
dependencies that are required for this change. Add links to Notion,
Figma or any other documents that might be relevant to the PR._


Fixes #`Issue Number`  
_or_  
Fixes `Issue URL`
> [!WARNING]  
> _If no issue exists, please create an issue first, and check with the
maintainers if the issue is valid._

## Automation

/ok-to-test tags="@tag.Sanity"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/14195152272>
> Commit: cabf08853025dffdaaa5de33924e6d8fe9493c3d
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=14195152272&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Sanity`
> Spec:
> <hr>Tue, 01 Apr 2025 12:50:05 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Improved the post-signup flow by adjusting the redirection behavior
based on whether the user is on the login page.
- Introduced organizational context detection to ensure users are
navigated to the appropriate destination after signup.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
albinAppsmith 2025-04-02 09:29:38 +05:30 committed by GitHub
parent 9e196f5724
commit 2c0e608946
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 21 additions and 3 deletions

View File

@ -62,3 +62,6 @@ export const getHideWatermark = (state: AppState): boolean =>
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export const isFreePlan = (state: AppState) => true;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export const isWithinAnOrganization = (state: AppState) => true;

View File

@ -28,6 +28,7 @@ export const redirectUserAfterSignup = (
// eslint-disable-next-line @typescript-eslint/no-explicit-any
dispatch?: any,
isEnabledForCreateNew?: boolean, // is Enabled for only non-invited users
isOnLoginPage?: boolean,
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
): any => {
@ -100,7 +101,9 @@ export const redirectUserAfterSignup = (
error("Error handling the redirect url");
}
} else {
history.replace(APPLICATIONS_URL);
if (!isOnLoginPage) {
history.replace(APPLICATIONS_URL);
}
}
};

View File

@ -8,7 +8,10 @@ import { getCurrentUser } from "selectors/usersSelectors";
import UserWelcomeScreen from "pages/setup/UserWelcomeScreen";
import { Center } from "pages/setup/common";
import { Spinner } from "@appsmith/ads";
import { isValidLicense } from "ee/selectors/organizationSelectors";
import {
isValidLicense,
isWithinAnOrganization,
} from "ee/selectors/organizationSelectors";
import { redirectUserAfterSignup } from "ee/utils/signupHelpers";
import { setUserSignedUpFlag } from "utils/storage";
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
@ -22,6 +25,7 @@ export function SignupSuccess() {
);
const validLicense = useSelector(isValidLicense);
const user = useSelector(getCurrentUser);
const isOnLoginPage = !useSelector(isWithinAnOrganization);
useEffect(() => {
user?.email && setUserSignedUpFlag(user?.email);
@ -37,8 +41,16 @@ export function SignupSuccess() {
validLicense,
dispatch,
isNonInvitedUser,
isOnLoginPage,
),
[],
[
dispatch,
isNonInvitedUser,
isOnLoginPage,
redirectUrl,
shouldEnableFirstTimeUserOnboarding,
validLicense,
],
);
const onGetStarted = useCallback((proficiency?: string, useCase?: string) => {