Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5a90228

Browse files
authored
feat: fix 404 on the first app loads when unauthenticated (#10262)
* feat: fix 404 on the first app loads when unauthenticated* Update site/src/pages/LoginPage/LoginPage.tsx
1 parent8ffe0e2 commit5a90228

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

‎site/src/pages/LoginPage/LoginPage.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,29 @@ export const LoginPage: FC = () => {
2121
constnavigate=useNavigate();
2222

2323
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+
constredirectURL=newURL(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+
}
2447
return<Navigateto={redirectTo}replace/>;
2548
}elseif(isConfiguringTheFirstUser){
2649
return<Navigateto="/setup"replace/>;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp