From 46774e523ef4beff5c47ec7e2c0e0f1850edcd54 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Mon, 11 Oct 2021 14:15:20 +0200 Subject: [PATCH] wip #4765 --- composer.json | 4 +-- routes/socialite.php | 2 -- src/CubistSocialiteAuthServiceProvider.php | 31 -------------------- src/Http/Controllers/SocialiteController.php | 17 +---------- 4 files changed, 2 insertions(+), 52 deletions(-) delete mode 100644 src/CubistSocialiteAuthServiceProvider.php diff --git a/composer.json b/composer.json index 46be5cc..04f690f 100644 --- a/composer.json +++ b/composer.json @@ -26,8 +26,7 @@ "barryvdh/laravel-debugbar": "^3.6", "mpyw/null-auth": "^2.0", "spatie/laravel-permission": "^4.0|^5.1", - "laravel/framework": "^8.63", - "cubist/cms-back": "dev-master" + "laravel/framework": "^8.63" }, "repositories": [ { @@ -39,7 +38,6 @@ "laravel": { "providers": [ "Cubist\\Socialite\\CubistSocialiteServiceProvider", - "Cubist\\Socialite\\CubistSocialiteAuthServiceProvider" ] } } diff --git a/routes/socialite.php b/routes/socialite.php index a3718d9..89e0f2c 100644 --- a/routes/socialite.php +++ b/routes/socialite.php @@ -1,7 +1,5 @@ 'Cubist\Socialite\Http\Controllers','middleware' => ['web']], function () { - Route::get("socialite/login", "SocialiteController@login"); - Route::get("socialite/redirect/{provider}", "SocialiteController@redirect")->name('socialite.redirect'); Route::get("socialite/callback/{provider}", "SocialiteController@callback")->name('socialite.callback'); }); \ No newline at end of file diff --git a/src/CubistSocialiteAuthServiceProvider.php b/src/CubistSocialiteAuthServiceProvider.php deleted file mode 100644 index 7a25c2a..0000000 --- a/src/CubistSocialiteAuthServiceProvider.php +++ /dev/null @@ -1,31 +0,0 @@ -registerPolicies(); - - Auth::viaRequest('socialitegoogle', function (Request $request) { - try { - $user= User::fromProvider('google'); - debug('viarequest/socialitegoogle',$user); - return $user; - } catch (\Exception $e) { - return null; - } - }); - } -} \ No newline at end of file diff --git a/src/Http/Controllers/SocialiteController.php b/src/Http/Controllers/SocialiteController.php index 9afaf6e..a16fc59 100644 --- a/src/Http/Controllers/SocialiteController.php +++ b/src/Http/Controllers/SocialiteController.php @@ -11,21 +11,6 @@ class SocialiteController extends Controller { protected $providers = ["google"]; - public function login() - { - return view(CubistSocialiteServiceProvider::NAMESPACE . "::login"); - } - - public function redirect() - { - $provider = request()->provider; - if (in_array($provider, $this->providers, true)) { - return Socialite::driver($provider)->stateless()->redirect(); - } - abort(403); - } - - public function callback() { $provider = request()->provider; @@ -36,7 +21,7 @@ class SocialiteController extends Controller Auth::login($authUser, true); return redirect('/test'); } catch (\Exception $e) { - dd($e); + return Socialite::driver($provider)->stateless()->redirect(); } } } -- 2.39.5