diff --git a/app/Http/Middleware/App/HandleInertiaRequests.php b/app/Http/Middleware/App/HandleInertiaRequests.php index dab26efc..6deda69c 100644 --- a/app/Http/Middleware/App/HandleInertiaRequests.php +++ b/app/Http/Middleware/App/HandleInertiaRequests.php @@ -47,6 +47,7 @@ public function share(Request $request): array '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 f860264f..e8e2f8da 100644 --- a/config/trypost.php +++ b/config/trypost.php @@ -16,6 +16,18 @@ '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 9d5a1b9f..2be5550e 100644 --- a/resources/js/pages/auth/Login.vue +++ b/resources/js/pages/auth/Login.vue @@ -66,16 +66,18 @@ defineProps<{ -
- {{ $t('auth.or_continue_with') }} -
+
{{ $t('auth.login.no_account') }} diff --git a/resources/js/pages/auth/Register.vue b/resources/js/pages/auth/Register.vue index 4f59fc62..0fa1becd 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;
-
- {{ $t('auth.or_continue_with') }} -
+
{{ $t('auth.register.has_account') }} diff --git a/routes/auth.php b/routes/auth.php index 798ec5e8..cd3deaab 100644 --- a/routes/auth.php +++ b/routes/auth.php @@ -29,8 +29,10 @@ 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 () {