File tree 1 file changed +23
-0
lines changed
1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,29 @@ export const LoginPage: FC = () => {
21
21
const navigate = useNavigate ( ) ;
22
22
23
23
if ( isSignedIn ) {
24
+ // If the redirect is going to a workspace application, and we
25
+ // are missing authentication, then we need to change the href location
26
+ // to trigger a HTTP request. This allows the BE to generate the auth
27
+ // cookie required.
28
+ // If no redirect is present, then ignore this branched logic.
29
+ if ( redirectTo !== "" && redirectTo !== "/" ) {
30
+ try {
31
+ // This catches any absolute redirects. Relative redirects
32
+ // will fail the try/catch. Subdomain apps are absolute redirects.
33
+ const redirectURL = new URL ( redirectTo ) ;
34
+ if ( redirectURL . host !== window . location . host ) {
35
+ window . location . href = redirectTo ;
36
+ return < > </ > ;
37
+ }
38
+ } catch {
39
+ // Do nothing
40
+ }
41
+ // Path based apps.
42
+ if ( redirectTo . includes ( "/apps/" ) ) {
43
+ window . location . href = redirectTo ;
44
+ return < > </ > ;
45
+ }
46
+ }
24
47
return < Navigate to = { redirectTo } replace /> ;
25
48
} else if ( isConfiguringTheFirstUser ) {
26
49
return < Navigate to = "/setup" replace /> ;
You can’t perform that action at this time.
0 commit comments