ToolJet/frontend/src/Oauth/Authorize.jsx

188 lines
7.1 KiB
React
Raw Normal View History

import React, { useEffect, useState } from 'react';
import useRouter from '@/_hooks/use-router';
2025-07-11 09:50:12 +00:00
import { aiOnboardingService, appService, authenticationService } from '@/_services';
import { Navigate } from 'react-router-dom';
import Configs from './Configs/Config.json';
[feature] Make workspace urls more readable (#6698) * working on replacing workspace id with workspace name * experimenting with zustand * added slug column to workspace table * working on workspace url * working on backward compatibility * fixing bugs * added not found error * fixed workspace switching issue * fix: switching b/w workspaces * fix: workspace login * changed workspace login url link * resolved conflicts * added create organization design * added backend validation * fixed constraint errors issue * fixed: creating new workspace * fixed: update workspace * fixed: update workspace bugs * fixed: auto created slug bugs * fixed: login slug * design changes * added folder slug * fixed: lint error * fixed: invite and first user issues * fixed: login page redirection * fixed: redirect path * added reserved word check * fix: edit workspace design * fix: folder query issue * fix: create and edit workspace modal validation issues * fixing failed test cases * fixing failed test cases - app.e2e * fixed organizations specs * fixed public app issue * working on app slug * Added app slug design to the general settings * Working on appId -> slug changes - Handling appId cases - Fixing issues * Worked on share modal design change - replaced slug functionality - Fixed backend slug issues - Fixed page handle issues * changed switch label * replace version param with query param * fix: possible uuid bug * fix: login app slug redirection issue * Worked on unique app slug * moved all apps related api calls to apps.service.js file * refactoring the code and fixing minor issues * Refactored and fixed some bugs * Fixed bugs: redirect cookie issue * Fixed dark-mode issues * removed duplicate code * Worked on develop branch conflicts * Moved handle app access check to private route * Added fix for navigate * Refactored the code. Added slug to failed sso login redirection path * again some redirect url fixes * onbaord navbar tj-icon onclick * Fix: viewer version id undefined issue * fix: multi-pages, invalid workspace slug * fix: removing the version search param while switching the pages * fix-sso: redirecting to prev tab's login organization slug * fix-sso: google signup * fix: preivew permission issue * Fixing merge issues * Fixed tjdb issues * dark mode fix of manage users button * fix: extra slash in url, tj-logo on click wrong org id * subpath workspace login url * resolved lint issue * fix: cannot clone apps * fixed switch workspace issue * fix: login page flashing issue * fix: back button issue * fix: private endless redirection * Update the modal with new UX * fixed all ui issues * fixed placeholder translation issues * fix: sso multi-request issues * fix: multi-pages crash while promoting a version * fix: error text msg delay * added default slug to the first workspace in the instance * subpath-fix: slug preview url * fix: same value check * fixed switch page query params issue * fix: folder query * fix: manage app users ui responsive issue * Backend PR changes --------- Co-authored-by: gsmithun4 <gsmithun4@gmail.com>
2023-10-18 07:30:17 +00:00
import { getCookie } from '@/_helpers';
2025-02-25 06:52:50 +00:00
import { TJLoader } from '@/_ui/TJLoader/TJLoader';
import { onInvitedUserSignUpSuccess, onLoginSuccess } from '@/_helpers/platform/utils/auth.utils';
2024-03-07 19:22:26 +00:00
import { updateCurrentSession } from '@/_helpers/authorizeWorkspace';
2025-07-10 13:23:54 +00:00
import posthogHelper from '@/modules/common/helpers/posthogHelper';
import { fetchEdition } from '@/modules/common/helpers/utils';
export function Authorize({ navigate }) {
const [error, setError] = useState('');
const [inviteeEmail, setInviteeEmail] = useState();
const router = useRouter();
const organizationId = authenticationService.getLoginOrganizationId();
[feature] Make workspace urls more readable (#6698) * working on replacing workspace id with workspace name * experimenting with zustand * added slug column to workspace table * working on workspace url * working on backward compatibility * fixing bugs * added not found error * fixed workspace switching issue * fix: switching b/w workspaces * fix: workspace login * changed workspace login url link * resolved conflicts * added create organization design * added backend validation * fixed constraint errors issue * fixed: creating new workspace * fixed: update workspace * fixed: update workspace bugs * fixed: auto created slug bugs * fixed: login slug * design changes * added folder slug * fixed: lint error * fixed: invite and first user issues * fixed: login page redirection * fixed: redirect path * added reserved word check * fix: edit workspace design * fix: folder query issue * fix: create and edit workspace modal validation issues * fixing failed test cases * fixing failed test cases - app.e2e * fixed organizations specs * fixed public app issue * working on app slug * Added app slug design to the general settings * Working on appId -> slug changes - Handling appId cases - Fixing issues * Worked on share modal design change - replaced slug functionality - Fixed backend slug issues - Fixed page handle issues * changed switch label * replace version param with query param * fix: possible uuid bug * fix: login app slug redirection issue * Worked on unique app slug * moved all apps related api calls to apps.service.js file * refactoring the code and fixing minor issues * Refactored and fixed some bugs * Fixed bugs: redirect cookie issue * Fixed dark-mode issues * removed duplicate code * Worked on develop branch conflicts * Moved handle app access check to private route * Added fix for navigate * Refactored the code. Added slug to failed sso login redirection path * again some redirect url fixes * onbaord navbar tj-icon onclick * Fix: viewer version id undefined issue * fix: multi-pages, invalid workspace slug * fix: removing the version search param while switching the pages * fix-sso: redirecting to prev tab's login organization slug * fix-sso: google signup * fix: preivew permission issue * Fixing merge issues * Fixed tjdb issues * dark mode fix of manage users button * fix: extra slash in url, tj-logo on click wrong org id * subpath workspace login url * resolved lint issue * fix: cannot clone apps * fixed switch workspace issue * fix: login page flashing issue * fix: back button issue * fix: private endless redirection * Update the modal with new UX * fixed all ui issues * fixed placeholder translation issues * fix: sso multi-request issues * fix: multi-pages crash while promoting a version * fix: error text msg delay * added default slug to the first workspace in the instance * subpath-fix: slug preview url * fix: same value check * fixed switch page query params issue * fix: folder query * fix: manage app users ui responsive issue * Backend PR changes --------- Co-authored-by: gsmithun4 <gsmithun4@gmail.com>
2023-10-18 07:30:17 +00:00
const organizationSlug = authenticationService.getLoginOrganizationSlug();
const redirectUrl = getCookie('redirectPath');
const signupOrganizationSlug = authenticationService.getSignupOrganizationSlug();
const inviteFlowIdentifier = authenticationService.getInviteFlowIndetifier();
useEffect(() => {
const errorMessage = router.query.error_description || router.query.error;
if (errorMessage) {
return setError(errorMessage);
}
if (!(router.query.origin && Configs[router.query.origin])) {
return setError('Login failed');
}
const configs = Configs[router.query.origin];
const authParams = {};
if (configs.responseType === 'hash') {
if (!window.location.hash) {
return setError('Login failed');
}
const params = new Proxy(new URLSearchParams(window.location.hash.substr(1)), {
get: (searchParams, prop) => searchParams.get(prop),
});
authParams.token = params[configs.params.token];
authParams.state = params[configs.params.state];
} else {
authParams.token = router.query[configs.params.token];
authParams.state = router.query[configs.params.state];
2025-02-25 06:52:50 +00:00
authParams.iss = router.query[configs.params.iss];
}
/* If the params has SAMLResponse the SAML auth is success */
if (router.query.saml_response_id) {
authParams.samlResponseId = router.query.saml_response_id;
}
[Improvement] URLs scoped with workspace id (#5487) * add: new URL prefix * fix: working on home page * add: profile path * playing with rxjs * removed context part * working on path changes * changing routes - TODO: replace the workspaceId with actual id * redo: public apps path * initial commit * added authorize API * remove privileges from auth response * fixed some api issue - added subscriptions * fix: redirect url workspace-id null issue * fix: switch workspace * fix: organization list mapping - menu item paths * fix: preview url - editor, viewer permission mapping * jwt fix * fix: some url issue - permission mappings - workspace login * fixed some issues - user invite workspace-id - org settings menu item default selected item issue * app viewer fixes * fixing workspace login issues * fix * fixing issues - tooljet db - path issues - refatoring the code * fix: workspace vars permissions * fix: multi-page handle * fix: create app from template * fix: bulk user upload * fix: import app - clone app - upload profile image * fix: onboarding * fix: log out * fixed multi-workspace logout issue * fix: launch btn * fix: oauth2 * fixes * fix: sso login * fix: workspace sso login * fixing sso issues * fix: moved list of orgs to rxjs - fixed switching issues * reverting some changes * fixed some minor bugs * fixing sso redirect url issues * fix: switching network timing issues * fix: back to workspace-id * fix: tj-database - refactored the code - removed org id from some pages - will get the org id from the service file only * fix: multi-pages * fix: infinite loop issue * fixing workspace switching issue * fixes - comment link - logout & private route redirect url * fix: wrong uuid error * fixing subpath - fixed most of the places - need to test & fix workspace login, sso, new account * fix: subpath workspace login * fix: rxjs handle bug * Revert "fix: tj-database" This reverts commit 9632ec2ff0707c9d7b1777f64afbe15679203ca1. * fix: reverted tj-db changes * fix: subpath sso * typo fix * fix: existing session issues * new: switch workspace page * fix: modal dark-mode * added default sso support * fixes - subpath workspace switching - handle wrong routes * fix: manager user button - refactored the code * removed SINGLE Workspace feature * rebase * add: change modal text * fix: added validation * fixed private app 401 issue * initial commit * fix: logged out session multi-tab issue * refactoring the code * fix: redirect url issue * added auth-token in cookies * Fix: failing e2e specs * added session API * fix: backend session guard * fix: removing user details from local storage * fix: null wid * undo and redo * fix: login page * fix: viewer login redirection * fix: login page redirection * fix: public apps logout issue * added session storage and scheduler * added profile api * fix: sso login - switch workspace - login page - setup admin * working on fixes * fix: socket issue * fix: setup admin api * connected profile & logout apis * fix: malfunctioned auth token case * fix: realtime avatar * fix: profile avatar * fix: Realtime cursors avatar * setting max age for auth token cookie * add: Go to login page if logout api returns 401 * fix: subpath login * fix * fix: app logout [viewer] * fix: authorize page * remove expiry from jwt * fix: integrations route - session api * small fix * fix: updated profile * fix: workspace login [logged user] * fix: oauth and another workspace page issue * fixed app preview logout issue * subpath fix * fix: subpath app id * fix: selected state didnt change for apps page [subpath] * fix * add cookie parser to test app * specs added * increased user session expiry time * test: session & new apis * working on test cases * fix: onboarding issue * fixing specs * fix: test cases * fix: removing profile api calls * some fixes * fixing rebase issues * fix: global ds issues * fix: app is crashing * fix: back to text * fix: oauth test cases * fix: test-helper * fix: onboarding test cases * fix: tests again * refactoring the code * latest develop merging precautions - fixed a minor null issue * fix: typo * fix :menu issues due to the merging * fix: - clicking on tooljet logo didnt redirect to login page for public apps - private app preview doesnt load after login * subpath fixes * fixed back to issue * PR changes * fix: spec fixes for EE * doc: URL scoped for workspace --------- Co-authored-by: gsmithun4 <gsmithun4@gmail.com> Co-authored-by: Shubhendra <withshubh@gmail.com>
2023-04-06 11:12:58 +00:00
let subsciption;
if (organizationId) {
subsciption = authenticationService.currentSession.subscribe((session) => {
//logged users should send tj-workspace-id when login to unauthorized workspace
if (session.authentication_status === false || session.current_organization_id) {
signIn(authParams, configs);
[feature] Make workspace urls more readable (#6698) * working on replacing workspace id with workspace name * experimenting with zustand * added slug column to workspace table * working on workspace url * working on backward compatibility * fixing bugs * added not found error * fixed workspace switching issue * fix: switching b/w workspaces * fix: workspace login * changed workspace login url link * resolved conflicts * added create organization design * added backend validation * fixed constraint errors issue * fixed: creating new workspace * fixed: update workspace * fixed: update workspace bugs * fixed: auto created slug bugs * fixed: login slug * design changes * added folder slug * fixed: lint error * fixed: invite and first user issues * fixed: login page redirection * fixed: redirect path * added reserved word check * fix: edit workspace design * fix: folder query issue * fix: create and edit workspace modal validation issues * fixing failed test cases * fixing failed test cases - app.e2e * fixed organizations specs * fixed public app issue * working on app slug * Added app slug design to the general settings * Working on appId -> slug changes - Handling appId cases - Fixing issues * Worked on share modal design change - replaced slug functionality - Fixed backend slug issues - Fixed page handle issues * changed switch label * replace version param with query param * fix: possible uuid bug * fix: login app slug redirection issue * Worked on unique app slug * moved all apps related api calls to apps.service.js file * refactoring the code and fixing minor issues * Refactored and fixed some bugs * Fixed bugs: redirect cookie issue * Fixed dark-mode issues * removed duplicate code * Worked on develop branch conflicts * Moved handle app access check to private route * Added fix for navigate * Refactored the code. Added slug to failed sso login redirection path * again some redirect url fixes * onbaord navbar tj-icon onclick * Fix: viewer version id undefined issue * fix: multi-pages, invalid workspace slug * fix: removing the version search param while switching the pages * fix-sso: redirecting to prev tab's login organization slug * fix-sso: google signup * fix: preivew permission issue * Fixing merge issues * Fixed tjdb issues * dark mode fix of manage users button * fix: extra slash in url, tj-logo on click wrong org id * subpath workspace login url * resolved lint issue * fix: cannot clone apps * fixed switch workspace issue * fix: login page flashing issue * fix: back button issue * fix: private endless redirection * Update the modal with new UX * fixed all ui issues * fixed placeholder translation issues * fix: sso multi-request issues * fix: multi-pages crash while promoting a version * fix: error text msg delay * added default slug to the first workspace in the instance * subpath-fix: slug preview url * fix: same value check * fixed switch page query params issue * fix: folder query * fix: manage app users ui responsive issue * Backend PR changes --------- Co-authored-by: gsmithun4 <gsmithun4@gmail.com>
2023-10-18 07:30:17 +00:00
subsciption.unsubscribe();
[Improvement] URLs scoped with workspace id (#5487) * add: new URL prefix * fix: working on home page * add: profile path * playing with rxjs * removed context part * working on path changes * changing routes - TODO: replace the workspaceId with actual id * redo: public apps path * initial commit * added authorize API * remove privileges from auth response * fixed some api issue - added subscriptions * fix: redirect url workspace-id null issue * fix: switch workspace * fix: organization list mapping - menu item paths * fix: preview url - editor, viewer permission mapping * jwt fix * fix: some url issue - permission mappings - workspace login * fixed some issues - user invite workspace-id - org settings menu item default selected item issue * app viewer fixes * fixing workspace login issues * fix * fixing issues - tooljet db - path issues - refatoring the code * fix: workspace vars permissions * fix: multi-page handle * fix: create app from template * fix: bulk user upload * fix: import app - clone app - upload profile image * fix: onboarding * fix: log out * fixed multi-workspace logout issue * fix: launch btn * fix: oauth2 * fixes * fix: sso login * fix: workspace sso login * fixing sso issues * fix: moved list of orgs to rxjs - fixed switching issues * reverting some changes * fixed some minor bugs * fixing sso redirect url issues * fix: switching network timing issues * fix: back to workspace-id * fix: tj-database - refactored the code - removed org id from some pages - will get the org id from the service file only * fix: multi-pages * fix: infinite loop issue * fixing workspace switching issue * fixes - comment link - logout & private route redirect url * fix: wrong uuid error * fixing subpath - fixed most of the places - need to test & fix workspace login, sso, new account * fix: subpath workspace login * fix: rxjs handle bug * Revert "fix: tj-database" This reverts commit 9632ec2ff0707c9d7b1777f64afbe15679203ca1. * fix: reverted tj-db changes * fix: subpath sso * typo fix * fix: existing session issues * new: switch workspace page * fix: modal dark-mode * added default sso support * fixes - subpath workspace switching - handle wrong routes * fix: manager user button - refactored the code * removed SINGLE Workspace feature * rebase * add: change modal text * fix: added validation * fixed private app 401 issue * initial commit * fix: logged out session multi-tab issue * refactoring the code * fix: redirect url issue * added auth-token in cookies * Fix: failing e2e specs * added session API * fix: backend session guard * fix: removing user details from local storage * fix: null wid * undo and redo * fix: login page * fix: viewer login redirection * fix: login page redirection * fix: public apps logout issue * added session storage and scheduler * added profile api * fix: sso login - switch workspace - login page - setup admin * working on fixes * fix: socket issue * fix: setup admin api * connected profile & logout apis * fix: malfunctioned auth token case * fix: realtime avatar * fix: profile avatar * fix: Realtime cursors avatar * setting max age for auth token cookie * add: Go to login page if logout api returns 401 * fix: subpath login * fix * fix: app logout [viewer] * fix: authorize page * remove expiry from jwt * fix: integrations route - session api * small fix * fix: updated profile * fix: workspace login [logged user] * fix: oauth and another workspace page issue * fixed app preview logout issue * subpath fix * fix: subpath app id * fix: selected state didnt change for apps page [subpath] * fix * add cookie parser to test app * specs added * increased user session expiry time * test: session & new apis * working on test cases * fix: onboarding issue * fixing specs * fix: test cases * fix: removing profile api calls * some fixes * fixing rebase issues * fix: global ds issues * fix: app is crashing * fix: back to text * fix: oauth test cases * fix: test-helper * fix: onboarding test cases * fix: tests again * refactoring the code * latest develop merging precautions - fixed a minor null issue * fix: typo * fix :menu issues due to the merging * fix: - clicking on tooljet logo didnt redirect to login page for public apps - private app preview doesnt load after login * subpath fixes * fixed back to issue * PR changes * fix: spec fixes for EE * doc: URL scoped for workspace --------- Co-authored-by: gsmithun4 <gsmithun4@gmail.com> Co-authored-by: Shubhendra <withshubh@gmail.com>
2023-04-06 11:12:58 +00:00
}
});
} else {
signIn(authParams, configs);
}
// Disabled for useEffect not being called for updation
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
const signIn = (authParams, configs) => {
2025-07-11 09:50:12 +00:00
const handleAuthResponse = ({ redirect_url, ...restResponse }) => {
const { organization_id, current_organization_id, email } = restResponse;
2025-07-15 06:07:00 +00:00
const event = `${redirect_url ? 'signup' : 'signin'}_${
router.query.origin === 'google' ? 'google' : router.query.origin === 'openid' ? 'openid' : 'github'
}`;
posthogHelper.initPosthog(restResponse);
posthogHelper.captureEvent(event, {
email,
workspace_id: organization_id || current_organization_id,
});
2025-07-11 09:50:12 +00:00
/* Precaution code to not take any previous values since there are two entry point to the app now (site and tooljet-app) */
authenticationService.deleteAllSSOCookies();
if (redirect_url) {
localStorage.setItem('ph-sso-type', router.query.origin); //for posthog event
window.location.href = redirect_url;
return;
}
if (restResponse?.organizationInviteUrl) onInvitedUserSignUpSuccess(restResponse, navigate);
else {
updateCurrentSession({
isUserLoggingIn: true,
2025-07-10 13:23:54 +00:00
});
2025-07-11 09:50:12 +00:00
onLoginSuccess(restResponse, navigate);
}
posthogHelper.initPosthog({ redirect_url, ...restResponse });
posthogHelper.captureEvent(event, {
email,
workspace_id: organization_id || current_organization_id,
});
2025-07-11 09:50:12 +00:00
};
const handleAuthError = (err) => {
console.log('SSO login error', err);
2025-07-11 09:50:12 +00:00
const details = err?.data?.message;
const inviteeEmail = details?.inviteeEmail;
if (inviteeEmail) setInviteeEmail(inviteeEmail);
let errorMessage = '';
if (details?.error && details?.data) {
errorMessage = `${details.error} ${details.data.join(', ')}`;
}
const errMessage = errorMessage || details?.error || details?.message || err?.error || 'something went wrong';
if (!inviteeEmail && inviteFlowIdentifier) {
/* Some unexpected error happened from the provider side. Need to retreive email to continue */
appService
.getInviteeDetails(inviteFlowIdentifier)
.then((response) => {
setInviteeEmail(response.email);
})
.catch(() => {
console.error('Error while fetching invitee details');
})
.finally(() => {
setError(`${configs.name} login failed - ${errMessage}`);
2024-03-07 19:22:26 +00:00
});
2025-07-11 09:50:12 +00:00
} else {
setError(`${configs.name} login failed - ${errMessage}`);
}
};
const hashParams = new URLSearchParams(window.location.hash.substring(1));
// FIXME: later create different component/login for cloud and ce/ee
const edition = fetchEdition();
if (edition === 'cloud') {
const isAiOnboarding =
hashParams.get('state')?.includes('tj_api_source=ai_onboarding') ||
router.query.state?.includes('tj_api_source=ai_onboarding');
const isNormalFlow = (organizationId || signupOrganizationSlug || inviteFlowIdentifier) && !isAiOnboarding;
if (isNormalFlow) {
/* For workspace signup and signin */
authenticationService
.signInViaOAuth(router.query.configId, router.query.origin, authParams)
.then(handleAuthResponse)
.catch(handleAuthError);
} else {
/* For ai onboarding */
aiOnboardingService
.signInViaOAuth(router.query.origin, authParams)
.then(handleAuthResponse)
.catch(handleAuthError);
}
return;
} else {
2025-07-11 09:50:12 +00:00
authenticationService
.signInViaOAuth(router.query.configId, router.query.origin, authParams)
.then(handleAuthResponse)
.catch(handleAuthError);
}
[Improvement] URLs scoped with workspace id (#5487) * add: new URL prefix * fix: working on home page * add: profile path * playing with rxjs * removed context part * working on path changes * changing routes - TODO: replace the workspaceId with actual id * redo: public apps path * initial commit * added authorize API * remove privileges from auth response * fixed some api issue - added subscriptions * fix: redirect url workspace-id null issue * fix: switch workspace * fix: organization list mapping - menu item paths * fix: preview url - editor, viewer permission mapping * jwt fix * fix: some url issue - permission mappings - workspace login * fixed some issues - user invite workspace-id - org settings menu item default selected item issue * app viewer fixes * fixing workspace login issues * fix * fixing issues - tooljet db - path issues - refatoring the code * fix: workspace vars permissions * fix: multi-page handle * fix: create app from template * fix: bulk user upload * fix: import app - clone app - upload profile image * fix: onboarding * fix: log out * fixed multi-workspace logout issue * fix: launch btn * fix: oauth2 * fixes * fix: sso login * fix: workspace sso login * fixing sso issues * fix: moved list of orgs to rxjs - fixed switching issues * reverting some changes * fixed some minor bugs * fixing sso redirect url issues * fix: switching network timing issues * fix: back to workspace-id * fix: tj-database - refactored the code - removed org id from some pages - will get the org id from the service file only * fix: multi-pages * fix: infinite loop issue * fixing workspace switching issue * fixes - comment link - logout & private route redirect url * fix: wrong uuid error * fixing subpath - fixed most of the places - need to test & fix workspace login, sso, new account * fix: subpath workspace login * fix: rxjs handle bug * Revert "fix: tj-database" This reverts commit 9632ec2ff0707c9d7b1777f64afbe15679203ca1. * fix: reverted tj-db changes * fix: subpath sso * typo fix * fix: existing session issues * new: switch workspace page * fix: modal dark-mode * added default sso support * fixes - subpath workspace switching - handle wrong routes * fix: manager user button - refactored the code * removed SINGLE Workspace feature * rebase * add: change modal text * fix: added validation * fixed private app 401 issue * initial commit * fix: logged out session multi-tab issue * refactoring the code * fix: redirect url issue * added auth-token in cookies * Fix: failing e2e specs * added session API * fix: backend session guard * fix: removing user details from local storage * fix: null wid * undo and redo * fix: login page * fix: viewer login redirection * fix: login page redirection * fix: public apps logout issue * added session storage and scheduler * added profile api * fix: sso login - switch workspace - login page - setup admin * working on fixes * fix: socket issue * fix: setup admin api * connected profile & logout apis * fix: malfunctioned auth token case * fix: realtime avatar * fix: profile avatar * fix: Realtime cursors avatar * setting max age for auth token cookie * add: Go to login page if logout api returns 401 * fix: subpath login * fix * fix: app logout [viewer] * fix: authorize page * remove expiry from jwt * fix: integrations route - session api * small fix * fix: updated profile * fix: workspace login [logged user] * fix: oauth and another workspace page issue * fixed app preview logout issue * subpath fix * fix: subpath app id * fix: selected state didnt change for apps page [subpath] * fix * add cookie parser to test app * specs added * increased user session expiry time * test: session & new apis * working on test cases * fix: onboarding issue * fixing specs * fix: test cases * fix: removing profile api calls * some fixes * fixing rebase issues * fix: global ds issues * fix: app is crashing * fix: back to text * fix: oauth test cases * fix: test-helper * fix: onboarding test cases * fix: tests again * refactoring the code * latest develop merging precautions - fixed a minor null issue * fix: typo * fix :menu issues due to the merging * fix: - clicking on tooljet logo didnt redirect to login page for public apps - private app preview doesnt load after login * subpath fixes * fixed back to issue * PR changes * fix: spec fixes for EE * doc: URL scoped for workspace --------- Co-authored-by: gsmithun4 <gsmithun4@gmail.com> Co-authored-by: Shubhendra <withshubh@gmail.com>
2023-04-06 11:12:58 +00:00
};
const baseRoute = signupOrganizationSlug ? '/signup' : '/login';
const slug = signupOrganizationSlug ? signupOrganizationSlug : organizationSlug;
const errorURL = `${baseRoute}${error && slug ? `/${slug}` : '/'}${
!signupOrganizationSlug && redirectUrl ? `?redirectTo=${redirectUrl}` : ''
}`;
return (
<div>
2025-02-25 06:52:50 +00:00
<TJLoader />
{error && (
<Navigate
replace
to={errorURL}
state={{
errorMessage: error && error,
...(inviteFlowIdentifier ? { organizationToken: inviteFlowIdentifier, inviteeEmail } : {}),
}}
/>
)}
</div>
);
}