diff --git a/packages/studiocms_auth/src/components/OAuthButtonStack.astro b/packages/studiocms_auth/src/components/OAuthButtonStack.astro
index 731c4f2057..bae54cdfc1 100644
--- a/packages/studiocms_auth/src/components/OAuthButtonStack.astro
+++ b/packages/studiocms_auth/src/components/OAuthButtonStack.astro
@@ -1,12 +1,16 @@
---
+import { getLangFromUrl, useTranslations } from 'studiocms:i18n';
import { Divider } from '@studiocms/ui/components';
import OAuthButton from './OAuthButton.astro';
import { providerData, showOAuth } from './oAuthButtonProviders';
+const lang = getLangFromUrl(Astro.url);
+const t = useTranslations(lang, '@studiocms/auth:oauth-stack');
+
const shouldShowOAuth = showOAuth && providerData.some(({ enabled }) => enabled);
---
{ shouldShowOAuth && (
- or log in using
+ {t('or-login-with')}
{
providerData.map(({enabled, ...props}) => enabled &&
)
diff --git a/packages/studiocms_auth/src/components/StaticAuthCheck.astro b/packages/studiocms_auth/src/components/StaticAuthCheck.astro
new file mode 100644
index 0000000000..8452ea8976
--- /dev/null
+++ b/packages/studiocms_auth/src/components/StaticAuthCheck.astro
@@ -0,0 +1,33 @@
+---
+import { getUserData } from 'studiocms:auth/lib/user';
+import { StudioCMSRoutes } from 'studiocms:helpers/routemap';
+import { getLangFromUrl, useTranslatedPath } from 'studiocms:i18n';
+
+const { isLoggedIn } = await getUserData(Astro);
+// Get the language and translations
+const referer = Astro.request.headers.get('referer');
+
+if (!referer) {
+ throw new Error('No referer found');
+}
+
+const lang = getLangFromUrl(new URL(referer));
+const translatePath = useTranslatedPath(lang);
+const {
+ mainLinks: { dashboardIndex },
+} = StudioCMSRoutes;
+---
+
+
+
\ No newline at end of file
diff --git a/packages/studiocms_auth/src/integration.ts b/packages/studiocms_auth/src/integration.ts
index 9d2471ac6f..a47d202985 100644
--- a/packages/studiocms_auth/src/integration.ts
+++ b/packages/studiocms_auth/src/integration.ts
@@ -83,6 +83,7 @@ export default defineIntegration({
},
experimental: {
directRenderScript: true,
+ serverIslands: true,
},
vite: {
optimizeDeps: {
@@ -112,6 +113,11 @@ export default defineIntegration({
entrypoint: resolve('./routes/api/login.ts'),
enabled: usernameAndPasswordAPI,
},
+ {
+ pattern: 'logout',
+ entrypoint: resolve('./routes/api/logout.ts'),
+ enabled: dashboardEnabled && !options.dbStartPage,
+ },
{
pattern: 'register',
entrypoint: resolve('./routes/api/register.ts'),
@@ -170,7 +176,7 @@ export default defineIntegration({
},
{
pattern: 'logout/',
- entrypoint: resolve('./routes/logout.ts'),
+ entrypoint: resolve('./routes/logout.astro'),
enabled: dashboardEnabled && !options.dbStartPage,
},
{
diff --git a/packages/studiocms_auth/src/layouts/AuthLayout.astro b/packages/studiocms_auth/src/layouts/AuthLayout.astro
index e378f984bc..8d79a69273 100644
--- a/packages/studiocms_auth/src/layouts/AuthLayout.astro
+++ b/packages/studiocms_auth/src/layouts/AuthLayout.astro
@@ -21,10 +21,11 @@ const {
interface Props {
title: string;
description: string;
- lang?: string;
+ lang: string;
+ disableScreen?: boolean;
}
-const { title, description, lang = 'en' } = Astro.props;
+const { title, description, lang, disableScreen } = Astro.props;
// Get the site config
const siteConfig = await db
@@ -37,9 +38,10 @@ const siteConfig = await db
const loginPageBackground = siteConfig?.loginPageBackground;
const loginPageCustomImage = siteConfig?.loginPageCustomImage;
-const fallbackImageSrc = loginPageBackground === 'custom'
- ? loginPageCustomImage
- : validImages.find((x) => x.name !== 'custom' && x.name === loginPageBackground)?.dark; // TODO: Adapt to theme
+const fallbackImageSrc =
+ loginPageBackground === 'custom'
+ ? loginPageCustomImage
+ : validImages.find((x) => x.name !== 'custom' && x.name === loginPageBackground)?.dark; // TODO: Adapt to theme
---
@@ -87,7 +89,7 @@ const fallbackImageSrc = loginPageBackground === 'custom'
-
+ { !disableScreen &&
}