Skip to content

Commit 57dd781

Browse files
committed
fix: filament user and post-login redirect
1 parent 78e4f68 commit 57dd781

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

src/Actions/Auth/Filament/AuthenticateOauthCallback.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,6 @@ public function authenticate(string $provider, ProviderUser $providerAccount): R
4141

4242
$this->guard->login($user, Socialstream::hasRememberSessionFeatures());
4343

44-
return redirect()->route('filament.admin.pages.dashboard');
44+
return redirect()->route('filament.admin.home');
4545
}
4646
}

stubs/filament/app/Models/User.php

+14-8
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@
22

33
namespace App\Models;
44

5+
// use Illuminate\Contracts\Auth\MustVerifyEmail;
6+
7+
use Filament\Models\Contracts\FilamentUser;
8+
use Filament\Panel;
59
use Illuminate\Database\Eloquent\Factories\HasFactory;
610
use Illuminate\Foundation\Auth\User as Authenticatable;
711
use Illuminate\Notifications\Notifiable;
812
use JoelButcher\Socialstream\HasConnectedAccounts;
913
use Laravel\Sanctum\HasApiTokens;
1014

11-
class User extends Authenticatable
15+
class User extends Authenticatable implements FilamentUser
1216
{
13-
use HasApiTokens;
17+
use HasApiTokens, HasFactory, Notifiable;
1418
use HasConnectedAccounts;
15-
use HasFactory;
16-
use Notifiable;
1719

1820
/**
1921
* The attributes that are mass assignable.
@@ -27,23 +29,27 @@ class User extends Authenticatable
2729
];
2830

2931
/**
30-
* The attributes that should be hidden for arrays.
32+
* The attributes that should be hidden for serialization.
3133
*
3234
* @var array<int, string>
3335
*/
3436
protected $hidden = [
3537
'password',
3638
'remember_token',
37-
'two_factor_recovery_codes',
38-
'two_factor_secret',
3939
];
4040

4141
/**
42-
* The attributes that should be cast to native types.
42+
* The attributes that should be cast.
4343
*
4444
* @var array<string, string>
4545
*/
4646
protected $casts = [
4747
'email_verified_at' => 'datetime',
48+
'password' => 'hashed',
4849
];
50+
51+
public function canAccessPanel(Panel $panel): bool
52+
{
53+
return true;
54+
}
4955
}

0 commit comments

Comments
 (0)