Skip to content

Commit 9b4b180

Browse files
committed
fix(socialite): adding dusk ids back, and fixing some actions
1 parent d9edc70 commit 9b4b180

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

.github/workflows/tests.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ jobs:
5151
- name: Generate Application Key
5252
run: php artisan key:generate
5353

54+
# Install the Chrome binaries required for Dusk to run tests
55+
- name: Install Chrome binaries
56+
run: php artisan dusk:chrome-driver --detect
57+
58+
# Start the Chrome driver so we're able to run browser tests with Chrome
59+
- name: Start Chrome Driver
60+
run: ./vendor/laravel/dusk/bin/chromedriver-linux &
61+
5462
- name: Run Migrations
5563
run: php artisan migrate
5664

app/Http/Controllers/Auth/SocialitePlusController.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
namespace App\Http\Controllers\Auth;
44

5-
use App\Http\Controllers\Controller;
65
use App\Models\User;
7-
use Blaspsoft\SocialitePlus\SocialitePlusFactory;
86
use Illuminate\Http\Request;
7+
use Blaspsoft\SocialitePlus\SocialitePlusFactory;
98
use Illuminate\Support\Facades\Auth;
9+
use App\Http\Controllers\Controller;
1010

1111
class SocialitePlusController extends Controller
1212
{
@@ -19,6 +19,8 @@ class SocialitePlusController extends Controller
1919

2020
/**
2121
* Create a new SocialLoginController instance.
22+
*
23+
* @param SocialitePlusFactory $socialitePlus
2224
*/
2325
public function __construct(SocialitePlusFactory $socialitePlus)
2426
{
@@ -28,6 +30,7 @@ public function __construct(SocialitePlusFactory $socialitePlus)
2830
/**
2931
* Redirect to the social login page
3032
*
33+
* @param string $provider
3134
* @return \Illuminate\Http\RedirectResponse
3235
*/
3336
public function redirect(string $provider)
@@ -44,21 +47,20 @@ public function redirect(string $provider)
4447
/**
4548
* Handle the social login callback
4649
*
50+
* @param string $provider
51+
* @param Request $request
4752
* @return \Illuminate\Http\RedirectResponse
4853
*/
4954
public function callback(string $provider, Request $request)
5055
{
51-
if (! $request->has('code')) {
52-
return redirect()->route('login')->with('error', 'Invalid request');
53-
}
56+
if (!$request->has('code')) return redirect()->route('login')->with('error', 'Invalid request');
5457

5558
$user = $this->socialitePlus->build($provider)->user();
5659

5760
$existingUser = User::where('email', $user->getEmail())->first();
5861

5962
if ($existingUser) {
6063
Auth::login($existingUser);
61-
6264
return redirect()->intended('/dashboard');
6365
}
6466

resources/js/components/socialite-plus.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ export default function SocialitePlus({ providersConfig }: SocialitePlusProps) {
5757
<Button
5858
key={provider.name}
5959
type="button"
60+
dusk={`${provider.name}-login-button`}
6061
variant="outline"
6162
className={getProviderClasses(provider)}
6263
tabIndex={5}

0 commit comments

Comments
 (0)