diff --git a/site/bun.lockb b/site/bun.lockb
index 12d6e31..fafe5b4 100755
Binary files a/site/bun.lockb and b/site/bun.lockb differ
diff --git a/site/src/pages/continue-page.tsx b/site/src/pages/continue-page.tsx
index e07cae3..a9b491e 100644
--- a/site/src/pages/continue-page.tsx
+++ b/site/src/pages/continue-page.tsx
@@ -1,8 +1,9 @@
-import { Button, Paper, Text } from "@mantine/core";
+import { Button, Code, Paper, Text } from "@mantine/core";
import { notifications } from "@mantine/notifications";
import { Navigate } from "react-router";
import { useUserContext } from "../context/user-context";
import { Layout } from "../components/layouts/layout";
+import { ReactNode } from "react";
export const ContinuePage = () => {
const queryString = window.location.search;
@@ -12,11 +13,11 @@ export const ContinuePage = () => {
const { isLoggedIn, disableContinue } = useUserContext();
if (!isLoggedIn) {
- return ;
+ return ;
}
- if (disableContinue && redirectUri !== "null") {
- window.location.replace(redirectUri!);
+ if (redirectUri === "null") {
+ return ;
}
const redirect = () => {
@@ -26,31 +27,62 @@ export const ContinuePage = () => {
color: "blue",
});
setTimeout(() => {
- window.location.replace(redirectUri!);
+ window.location.href = redirectUri!;
}, 500);
};
+ const urlParsed = URL.parse(redirectUri!);
+
+ if (
+ window.location.protocol === "https:" &&
+ urlParsed!.protocol === "http:"
+ ) {
+ return (
+
+
+ Insecure Redirect
+
+
+ Your are logged in but trying to redirect from https to{" "}
+ http, please click the button to redirect.
+
+
+
+ );
+ }
+
+ if (disableContinue) {
+ window.location.href = redirectUri!;
+ return (
+
+
+ Redirecting
+
+ You should be redirected to your app soon.
+
+ );
+ }
+
+ return (
+
+
+ Continue
+
+ Click the button to continue to your app.
+
+
+ );
+};
+
+export const ContinuePageLayout = ({ children }: { children: ReactNode }) => {
return (
- {redirectUri !== "null" ? (
- <>
-
- Continue
-
- Click the button to continue to your app.
-
- >
- ) : (
- <>
-
- Logged in
-
- You are now signed in and can use your apps.
- >
- )}
+ {children}
);
diff --git a/site/src/pages/login-page.tsx b/site/src/pages/login-page.tsx
index 3918890..4afa64a 100644
--- a/site/src/pages/login-page.tsx
+++ b/site/src/pages/login-page.tsx
@@ -65,8 +65,12 @@ export const LoginPage = () => {
color: "green",
});
setTimeout(() => {
- window.location.replace(`/continue?redirect_uri=${redirectUri}`);
- });
+ if (redirectUri === "null") {
+ window.location.replace("/");
+ } else {
+ window.location.replace(`/continue?redirect_uri=${redirectUri}`);
+ }
+ }, 500);
},
});
@@ -84,7 +88,14 @@ export const LoginPage = () => {
});
},
onSuccess: (data) => {
- window.location.replace(data.data.url);
+ notifications.show({
+ title: "Redirecting",
+ message: "Redirecting to your OAuth provider",
+ color: "blue",
+ });
+ setTimeout(() => {
+ window.location.href = data.data.url;
+ }, 500);
},
});
diff --git a/site/src/pages/logout-page.tsx b/site/src/pages/logout-page.tsx
index 4d4099c..f1a86c3 100644
--- a/site/src/pages/logout-page.tsx
+++ b/site/src/pages/logout-page.tsx
@@ -32,7 +32,7 @@ export const LogoutPage = () => {
color: "green",
});
setTimeout(() => {
- window.location.reload();
+ window.location.replace("/login");
}, 500);
},
});