diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx
index 72b9238..0559b26 100644
--- a/frontend/src/App.tsx
+++ b/frontend/src/App.tsx
@@ -5,8 +5,8 @@ export const App = () => {
const { isLoggedIn } = useUserContext();
if (isLoggedIn) {
- return ;
+ return ;
}
- return ;
+ return ;
};
diff --git a/frontend/src/components/domain-warning/domain-warning.tsx b/frontend/src/components/domain-warning/domain-warning.tsx
index 975a3ab..4f83b23 100644
--- a/frontend/src/components/domain-warning/domain-warning.tsx
+++ b/frontend/src/components/domain-warning/domain-warning.tsx
@@ -7,6 +7,7 @@ import {
} from "../ui/card";
import { Button } from "../ui/button";
import { Trans, useTranslation } from "react-i18next";
+import { useLocation } from "react-router";
interface Props {
onClick: () => void;
@@ -17,9 +18,13 @@ interface Props {
export const DomainWarning = (props: Props) => {
const { onClick, appUrl, currentUrl } = props;
const { t } = useTranslation();
+ const { search } = useLocation();
+
+ const searchParams = new URLSearchParams(search);
+ const redirectUri = searchParams.get("redirect_uri");
return (
-
+
{t("domainWarningTitle")}
@@ -31,10 +36,20 @@ export const DomainWarning = (props: Props) => {
/>
-
+
+
);
diff --git a/frontend/src/lib/i18n/locales/en-US.json b/frontend/src/lib/i18n/locales/en-US.json
index 7dfe414..b2dd900 100644
--- a/frontend/src/lib/i18n/locales/en-US.json
+++ b/frontend/src/lib/i18n/locales/en-US.json
@@ -54,5 +54,6 @@
"invalidInput": "Invalid input",
"domainWarningTitle": "Invalid Domain",
"domainWarningSubtitle": "This instance is configured to be accessed from {{appUrl}}, but {{currentUrl}} is being used. If you proceed, you may encounter issues with authentication.",
- "ignoreTitle": "Ignore"
+ "ignoreTitle": "Ignore",
+ "goToCorrectDomainTitle": "Go to correct domain"
}
\ No newline at end of file
diff --git a/frontend/src/lib/i18n/locales/en.json b/frontend/src/lib/i18n/locales/en.json
index 7dfe414..b2dd900 100644
--- a/frontend/src/lib/i18n/locales/en.json
+++ b/frontend/src/lib/i18n/locales/en.json
@@ -54,5 +54,6 @@
"invalidInput": "Invalid input",
"domainWarningTitle": "Invalid Domain",
"domainWarningSubtitle": "This instance is configured to be accessed from {{appUrl}}, but {{currentUrl}} is being used. If you proceed, you may encounter issues with authentication.",
- "ignoreTitle": "Ignore"
+ "ignoreTitle": "Ignore",
+ "goToCorrectDomainTitle": "Go to correct domain"
}
\ No newline at end of file
diff --git a/frontend/src/pages/continue-page.tsx b/frontend/src/pages/continue-page.tsx
index 4bb43b4..261be8b 100644
--- a/frontend/src/pages/continue-page.tsx
+++ b/frontend/src/pages/continue-page.tsx
@@ -49,7 +49,7 @@ export const ContinuePage = () => {
const handleRedirect = () => {
setLoading(true);
- window.location.replace(redirectUriObj!.toString());
+ window.location.assign(redirectUriObj!.toString());
};
useEffect(() => {
@@ -79,16 +79,21 @@ export const ContinuePage = () => {
}, []);
if (!isLoggedIn) {
- return ;
+ return (
+
+ );
}
if (!isValidRedirectUri || !isAllowedRedirectProto) {
- return ;
+ return ;
}
if (!isTrustedRedirectUri) {
return (
-
+
{t("continueUntrustedRedirectTitle")}
@@ -126,7 +131,7 @@ export const ContinuePage = () => {
if (isHttpsDowngrade) {
return (
-
+
{t("continueInsecureRedirectTitle")}
diff --git a/frontend/src/pages/login-page.tsx b/frontend/src/pages/login-page.tsx
index 8fae53f..fd7108c 100644
--- a/frontend/src/pages/login-page.tsx
+++ b/frontend/src/pages/login-page.tsx
@@ -113,8 +113,17 @@ export const LoginPage = () => {
[],
);
+ if (isLoggedIn && redirectUri) {
+ return (
+
+ );
+ }
+
if (isLoggedIn) {
- return ;
+ return ;
}
return (
diff --git a/frontend/src/pages/logout-page.tsx b/frontend/src/pages/logout-page.tsx
index 6b52ed2..17693bb 100644
--- a/frontend/src/pages/logout-page.tsx
+++ b/frontend/src/pages/logout-page.tsx
@@ -32,7 +32,7 @@ export const LogoutPage = () => {
});
redirectTimer.current = window.setTimeout(() => {
- window.location.replace("/login");
+ window.location.assign("/login");
}, 500);
},
onError: () => {
@@ -50,7 +50,7 @@ export const LogoutPage = () => {
);
if (!isLoggedIn) {
- return ;
+ return ;
}
return (
diff --git a/frontend/src/pages/totp-page.tsx b/frontend/src/pages/totp-page.tsx
index 3306b52..ef05565 100644
--- a/frontend/src/pages/totp-page.tsx
+++ b/frontend/src/pages/totp-page.tsx
@@ -57,7 +57,7 @@ export const TotpPage = () => {
);
if (!totpPending) {
- return ;
+ return ;
}
return (
diff --git a/internal/controller/context_controller.go b/internal/controller/context_controller.go
index f2bd068..7cea62f 100644
--- a/internal/controller/context_controller.go
+++ b/internal/controller/context_controller.go
@@ -1,6 +1,8 @@
package controller
import (
+ "fmt"
+ "net/url"
"tinyauth/internal/utils"
"github.com/gin-gonic/gin"
@@ -34,7 +36,6 @@ type AppContextResponse struct {
type ContextControllerConfig struct {
ConfiguredProviders []string
- DisableContinue bool
Title string
GenericName string
AppURL string
@@ -90,13 +91,15 @@ func (controller *ContextController) userContextHandler(c *gin.Context) {
}
func (controller *ContextController) appContextHandler(c *gin.Context) {
+ appUrl, _ := url.Parse(controller.Config.AppURL) // no need to check error, validated on startup
+
c.JSON(200, AppContextResponse{
Status: 200,
Message: "Success",
ConfiguredProviders: controller.Config.ConfiguredProviders,
Title: controller.Config.Title,
GenericName: controller.Config.GenericName,
- AppURL: controller.Config.AppURL,
+ AppURL: fmt.Sprintf("%s://%s", appUrl.Scheme, appUrl.Host),
RootDomain: controller.Config.RootDomain,
ForgotPasswordMessage: controller.Config.ForgotPasswordMessage,
BackgroundImage: controller.Config.BackgroundImage,