From 7813b6060c2ab5a090cb788c0b87712bd3de83ea Mon Sep 17 00:00:00 2001 From: Boy132 Date: Tue, 18 Jun 2024 22:05:08 +0200 Subject: [PATCH] Make oauth nullable & remove middleware from oauth callback (#418) * make oauth nullable * fix oauth callback middleware --- app/Models/User.php | 4 ++-- routes/auth.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Models/User.php b/app/Models/User.php index ebe905a6f..b49d2f677 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -42,7 +42,7 @@ use App\Notifications\SendPasswordReset as ResetPasswordNotification; * @property bool $use_totp * @property string|null $totp_secret * @property \Illuminate\Support\Carbon|null $totp_authenticated_at - * @property array $oauth + * @property array|null $oauth * @property bool $gravatar * @property \Illuminate\Support\Carbon|null $created_at * @property \Illuminate\Support\Carbon|null $updated_at @@ -165,7 +165,7 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac 'language' => 'string', 'use_totp' => 'boolean', 'totp_secret' => 'nullable|string', - 'oauth' => 'array', + 'oauth' => 'array|nullable', ]; protected function casts(): array diff --git a/routes/auth.php b/routes/auth.php index 7c572c91b..671bc462e 100644 --- a/routes/auth.php +++ b/routes/auth.php @@ -20,7 +20,7 @@ Route::get('/password/reset/{token}', [Auth\LoginController::class, 'index'])->n // Endpoints for OAuth Route::get('/oauth/redirect/{driver}', [Auth\OAuthController::class, 'redirect'])->name('auth.oauth.redirect'); -Route::get('/oauth/callback/{driver}', [Auth\OAuthController::class, 'callback'])->name('auth.oauth.callback'); +Route::get('/oauth/callback/{driver}', [Auth\OAuthController::class, 'callback'])->name('auth.oauth.callback')->withoutMiddleware('guest'); // Apply a throttle to authentication action endpoints, in addition to the // recaptcha endpoints to slow down manual attack spammers even more. 🤷‍