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
Son of Andy
Son of Andy15mo ago
are you trying to login as the newly created user? where are you setting the password?
Meymink
Meymink15mo ago
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(); }
Son of Andy
Son of Andy15mo ago
could it be also a hashing issue when he is creating a user? as its hashing the value before it hits the db
MoisesSegura
MoisesSeguraOP15mo ago
oh I have a suspicion it could be because of the hash
Meymink
Meymink15mo ago
I'm not sure, but i had the same issue. After i added a value to email_verified_at it worked.
Son of Andy
Son of Andy15mo ago
are you creating the password in the user show page?
MoisesSegura
MoisesSeguraOP15mo ago
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') ]);
Son of Andy
Son of Andy15mo ago
you can use the create lifecycle hooks to see the value of the form
Son of Andy
Son of Andy15mo ago
these can be used inside the filament/UserResource/Pages/CreateUser.php will all of your users have access to the admin panel?
MoisesSegura
MoisesSeguraOP15mo ago
yes, but only the admin can access to all resources
MoisesSegura
MoisesSeguraOP15mo ago
my user table already have a email_verified_at but its set to null even with the user I use to login
No description
MoisesSegura
MoisesSeguraOP15mo ago
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))
Son of Andy
Son of Andy15mo ago
nice one!
Sanjana
Sanjana14mo ago
not solved it creates different passwords for filament user and other user

Did you find this page helpful?