Skip to content

Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.

feat: add TRYPOST_GOOGLE_AUTH_ENABLED toggle to show/hide Google login on auth pages

Paulo Castellano57df5d52539a
diff --git a/app/Http/Middleware/App/HandleInertiaRequests.php b/app/Http/Middleware/App/HandleInertiaRequests.php
index dab26efcb..6deda69c0 100644
--- a/app/Http/Middleware/App/HandleInertiaRequests.php
+++ b/app/Http/Middleware/App/HandleInertiaRequests.php
@@ -47,6 +47,7 @@ class HandleInertiaRequests extends Middleware
'name' => $name,
])->values()->all(),
'selfHosted' => config('trypost.self_hosted'),
+ 'googleAuthEnabled' => config('trypost.google_auth_enabled'),
];
}
}
diff --git a/config/trypost.php b/config/trypost.php
index f860264f1..e8e2f8da9 100644
--- a/config/trypost.php
+++ b/config/trypost.php
@@ -16,6 +16,18 @@ return [
'self_hosted' => env('SELF_HOSTED', true),
+ /*
+ |--------------------------------------------------------------------------
+ | Google Authentication
+ |--------------------------------------------------------------------------
+ |
+ | Enable or disable "Login with Google" on the login and register pages.
+ | Disable this if you don't have Google OAuth credentials configured.
+ |
+ */
+
+ 'google_auth_enabled' => env('TRYPOST_GOOGLE_AUTH_ENABLED', false),
+
/*
|--------------------------------------------------------------------------
| Social Platforms
diff --git a/resources/js/pages/auth/Login.vue b/resources/js/pages/auth/Login.vue
index 9d5a1b9fb..2be5550e0 100644
--- a/resources/js/pages/auth/Login.vue
+++ b/resources/js/pages/auth/Login.vue
@@ -66,16 +66,18 @@ defineProps<{
</Button>
</div>
- <div
- class="relative text-center text-sm after:absolute after:inset-0 after:top-1/2 after:z-0 after:flex after:items-center after:border-t after:border-border"
- >
- <span class="relative z-10 bg-background px-2 text-muted-foreground">{{ $t('auth.or_continue_with') }}</span>
- </div>
+ <template v-if="$page.props.googleAuthEnabled">
+ <div
+ class="relative text-center text-sm after:absolute after:inset-0 after:top-1/2 after:z-0 after:flex after:items-center after:border-t after:border-border"
+ >
+ <span class="relative z-10 bg-background px-2 text-muted-foreground">{{ $t('auth.or_continue_with') }}</span>
+ </div>
- <Button variant="outline" class="w-full" as="a" :href="googleRedirect.url()">
- <img src="/images/social/google.svg" alt="Google" class="size-4" />
- {{ $t('auth.google_login') }}
- </Button>
+ <Button variant="outline" class="w-full" as="a" :href="googleRedirect.url()">
+ <img src="/images/social/google.svg" alt="Google" class="size-4" />
+ {{ $t('auth.google_login') }}
+ </Button>
+ </template>
<div class="text-center text-sm text-muted-foreground">
{{ $t('auth.login.no_account') }}
diff --git a/resources/js/pages/auth/Register.vue b/resources/js/pages/auth/Register.vue
index 4f59fc62c..0fa1becdb 100644
--- a/resources/js/pages/auth/Register.vue
+++ b/resources/js/pages/auth/Register.vue
@@ -123,16 +123,18 @@ const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
</Button>
</div>
- <div
- class="relative text-center text-sm after:absolute after:inset-0 after:top-1/2 after:z-0 after:flex after:items-center after:border-t after:border-border"
- >
- <span class="relative z-10 bg-background px-2 text-muted-foreground">{{ $t('auth.or_continue_with') }}</span>
- </div>
+ <template v-if="$page.props.googleAuthEnabled">
+ <div
+ class="relative text-center text-sm after:absolute after:inset-0 after:top-1/2 after:z-0 after:flex after:items-center after:border-t after:border-border"
+ >
+ <span class="relative z-10 bg-background px-2 text-muted-foreground">{{ $t('auth.or_continue_with') }}</span>
+ </div>
- <Button variant="outline" class="w-full" as="a" :href="googleRedirect.url()">
- <img src="/images/social/google.svg" alt="Google" class="size-4" />
- {{ $t('auth.google_signup') }}
- </Button>
+ <Button variant="outline" class="w-full" as="a" :href="googleRedirect.url()">
+ <img src="/images/social/google.svg" alt="Google" class="size-4" />
+ {{ $t('auth.google_signup') }}
+ </Button>
+ </template>
<div class="text-center text-sm text-muted-foreground">
{{ $t('auth.register.has_account') }}
diff --git a/routes/auth.php b/routes/auth.php
index 798ec5e85..cd3deaaba 100644
--- a/routes/auth.php
+++ b/routes/auth.php
@@ -29,8 +29,10 @@ Route::middleware(['guest'])->group(function () {
Route::get('/reset-password/{token}', [NewPasswordController::class, 'create'])->name('password.reset');
Route::post('/reset-password', [NewPasswordController::class, 'store'])->name('password.store');
- Route::get('/auth/google/redirect', [SocialLoginController::class, 'redirect'])->name('auth.google.redirect');
- Route::get('/auth/google/callback', [SocialLoginController::class, 'callback'])->name('auth.google.callback');
+ if (config('trypost.google_auth_enabled')) {
+ Route::get('/auth/google/redirect', [SocialLoginController::class, 'redirect'])->name('auth.google.redirect');
+ Route::get('/auth/google/callback', [SocialLoginController::class, 'callback'])->name('auth.google.callback');
+ }
});
Route::middleware(['auth'])->group(function () {