login error
:fi: help this error appears in login "this password does not use the bcrypt algorithm"
12 Replies
Weβre going to need more information/code to help with this.
I got the same error, when I look into my database the password is stored as plaintext instead of encrypted. I also have Nova running on the same project (transitioning to Filament), creating users from Nova work fine.
My Filament User resource is a "simple" resource.
I assume your .env APP_KEY is set? I can't see any other reason Filament would store it as plaintext since ->password() should ensure it is saved correctly.
APP_KEY is set in my .env
and you see it as plaintext stored in the db? Can you provide your user model?
strange, a quick fix you can chuck this on your model:
I have the same issue both on my development environment and my production environment. Thanks for this solution.
Small, but important change π
if (!Hash::needsRehash($value)) {
Needs to be
if (Hash::needsRehash($value)) {
Of course! we can thank AI for that π
Looking at the Filament\Pages\Auth\EditProfile there are some examples of setting the password, check the dehydrateStateUsing option.
protected function getPasswordFormComponent(): Component
{
return TextInput::make('password')
->label(('filament-panels::pages/auth/edit-profile.form.password.label'))
->password()
->revealable(filament()->arePasswordsRevealable())
->rule(Password::default())
->autocomplete('new-password')
->dehydrated(fn ($state): bool => filled($state))
->dehydrateStateUsing(fn ($state): string => Hash::make($state))
->live(debounce: 500)
->same('passwordConfirmation');
}
protected function getPasswordConfirmationFormComponent(): Component
{
return TextInput::make('passwordConfirmation')
->label(('filament-panels::pages/auth/edit-profile.form.password_confirmation.label'))
->password()
->revealable(filament()->arePasswordsRevealable())
->required()
->visible(fn (Get $get): bool => filled($get('password')))
->dehydrated(false);
}
Yep that does it too, I haven't used it as I use a jetstream one, my method does it for all possible scenarios π
True, your method is for all scenarios, nice work π π