Login issues

Using the shield plugin. Must be something simple but I'm stuck. In my seeder I have:
$user = User::factory()->create([
'name' => 'Admin User',
'email' => '[email protected]',
'password' => bcrypt('test'),
]);

$user->assignRole('super_admin');

$testuser = User::factory()->create([
'name' => 'Test User',
'email' => '[email protected]',
'password' => bcrypt('test'),
]);

$testuser->assignRole('Engineer');
$user = User::factory()->create([
'name' => 'Admin User',
'email' => '[email protected]',
'password' => bcrypt('test'),
]);

$user->assignRole('super_admin');

$testuser = User::factory()->create([
'name' => 'Test User',
'email' => '[email protected]',
'password' => bcrypt('test'),
]);

$testuser->assignRole('Engineer');
Logging in with [email protected] works, logging in with [email protected] IO get "These credentials do not match our records." Any suggestions?
Solution:
after many hours I realised that you get this message if you have not assigned the user the panel_user role. Adding this fixed the issue. Having the super admin role overrides the need for the panel_user role hence [email protected] was working: ```php $user = User::factory()->create([ 'name' => 'Admin User',...
Jump to solution
4 Replies
Dennis Koch
Dennis Koch2mo ago
Do you use a custom auth guard? (PS: Please check #✅┊rules on how to format code)
Solution
Arthur Pen
Arthur Pen2mo ago
after many hours I realised that you get this message if you have not assigned the user the panel_user role. Adding this fixed the issue. Having the super admin role overrides the need for the panel_user role hence [email protected] was working:
$user = User::factory()->create([
'name' => 'Admin User',
'email' => '[email protected]',
'password' => bcrypt('test'),
]);

$user->assignRole('super_admin');

$testuser = User::factory()->create([
'name' => 'Test User',
'email' => '[email protected]',
'password' => Hash::make('test'),
]);

$testuser->assignRole('panel_user');
$testuser->assignRole('Engineer');

$readonlyuser = User::create([
'name' => 'Readonly User',
'email' => '[email protected]',
'password' => bcrypt('test'),
]);

$readonlyuser->assignRole('panel_user');
$readonlyuser->assignRole('Read Only');
$user = User::factory()->create([
'name' => 'Admin User',
'email' => '[email protected]',
'password' => bcrypt('test'),
]);

$user->assignRole('super_admin');

$testuser = User::factory()->create([
'name' => 'Test User',
'email' => '[email protected]',
'password' => Hash::make('test'),
]);

$testuser->assignRole('panel_user');
$testuser->assignRole('Engineer');

$readonlyuser = User::create([
'name' => 'Readonly User',
'email' => '[email protected]',
'password' => bcrypt('test'),
]);

$readonlyuser->assignRole('panel_user');
$readonlyuser->assignRole('Read Only');
Dennis Koch
Dennis Koch2mo ago
There is no panel_user role in Filament. This is probably something you set up yourself? Or is this from #bezhansalleh-shield ?
Arthur Pen
Arthur PenOP2mo ago
Yes, apologies I'm using Shield. I've updated the original message to help anyone searching in the future

Did you find this page helpful?