I can't login into filament with a new user
I have no problem logging in when the user is created with the command: php artisan make:filament-user, but when I create a user in my UserResource and try to log in it says 'credentials doesn't match'. they both appears in the same table 'users'
15 Replies
are you trying to login as the newly created user? where are you setting the password?
Hi V01D, try to add a date in email_verified_at in the database and you will be able to login.
This is because in your User model you have set the following which is in the Filament installation guide:
public function canAccessPanel(Panel
$panel): bool
{
return str_ends_with($this->email, '@xxxx.com') && $this->hasVerifiedEmail();
}
could it be also a hashing issue when he is creating a user? as its hashing the value before it hits the db
oh I have a suspicion it could be because of the hash
I'm not sure, but i had the same issue. After i added a value to email_verified_at it worked.
are you creating the password in the user show page?
yeah
->schema([
TextInput::make('name')
->required(),
TextInput::make('email')
->email()
->required(),
TextInput::make('password')
->password()
->hiddenOn('edit', true)
->required(),
Select::make('roles')->multiple()->relationship('roles','name')
]);
you can use the create lifecycle hooks to see the value of the form
these can be used inside the filament/UserResource/Pages/CreateUser.php
will all of your users have access to the admin panel?
yes, but only the admin can access to all resources
my user table already have a email_verified_at but its set to null even with the user I use to login
I got it, it was the hash I just added hash function in the resource:
TextInput::make('password')
->password()
->dehydrateStateUsing(fn (string $state): string => Hash::make($state))
nice one!
not solved
it creates different passwords for filament user and other user