diff --git a/enjoy/src/main/window.ts b/enjoy/src/main/window.ts index f158d3811..c2dd71955 100644 --- a/enjoy/src/main/window.ts +++ b/enjoy/src/main/window.ts @@ -179,6 +179,14 @@ main.init = () => { }); logger.debug("will-redirect", detail.url); + if ( + detail.url.startsWith( + `${process.env.WEB_API_URL || WEB_API_URL}/oauth` + ) + ) { + logger.debug("prevent redirect", detail.url); + detail.preventDefault(); + } }); view.webContents.on("will-navigate", (detail) => { diff --git a/enjoy/src/renderer/components/login-form.tsx b/enjoy/src/renderer/components/login-form.tsx index aa260799a..a140eb0a0 100644 --- a/enjoy/src/renderer/components/login-form.tsx +++ b/enjoy/src/renderer/components/login-form.tsx @@ -10,7 +10,11 @@ import { import { useContext, useEffect, useRef, useState } from "react"; import { AppSettingsProviderContext } from "@renderer/context"; import { t } from "i18next"; -import { UserSettings, LanguageSettings } from "@renderer/components"; +import { + UserSettings, + LanguageSettings, + LoaderSpin, +} from "@renderer/components"; import { ChevronLeftIcon } from "lucide-react"; import intlTelInput from "intl-tel-input"; import "intl-tel-input/build/css/intlTelInput.css"; @@ -67,7 +71,6 @@ export const LoginForm = () => { const code = new URL(url).searchParams.get("code"); if (provider && code) { - setWebviewVisible(false); webApi .auth({ provider, code }) .then((user) => { @@ -75,6 +78,9 @@ export const LoginForm = () => { }) .catch((err) => { toast.error(err.message); + }) + .finally(() => { + setWebviewVisible(false); }); } } @@ -178,7 +184,9 @@ export const LoginForm = () => { {t("goBack")} -
+
+ +
);