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
tuyz
tuyz13mo ago
are you trying to login as the newly created user? where are you setting the password?
Meymink
Meymink13mo 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(); }
tuyz
tuyz13mo 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
MoisesSeguraOP13mo ago
oh I have a suspicion it could be because of the hash
Meymink
Meymink13mo ago
I'm not sure, but i had the same issue. After i added a value to email_verified_at it worked.
tuyz
tuyz13mo ago
are you creating the password in the user show page?
MoisesSegura
MoisesSeguraOP13mo 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') ]);
tuyz
tuyz13mo ago
you can use the create lifecycle hooks to see the value of the form
tuyz
tuyz13mo ago
these can be used inside the filament/UserResource/Pages/CreateUser.php will all of your users have access to the admin panel?
MoisesSegura
MoisesSeguraOP13mo ago
yes, but only the admin can access to all resources
MoisesSegura
MoisesSeguraOP13mo 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
MoisesSeguraOP13mo 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))
tuyz
tuyz13mo ago
nice one!
Sanjana
Sanjana12mo ago
not solved it creates different passwords for filament user and other user
Want results from more Discord servers?
Add your server