Password Hash should be Hidden on form

When I create a password, it's saving with hash. But It's not a good to showing the hash. Please help me to fix this.
TextInput::make('password')
->password()
->dehydrateStateUsing(fn (string $state): string => Hash::make($state))
->dehydrated(fn (?string $state): bool => filled($state))
->revealable()
->required(fn (Page $livewire) => ($livewire instanceof CreateRecord)),
TextInput::make('password')
->password()
->dehydrateStateUsing(fn (string $state): string => Hash::make($state))
->dehydrated(fn (?string $state): bool => filled($state))
->revealable()
->required(fn (Page $livewire) => ($livewire instanceof CreateRecord)),
Solution:
Make it hidden. The rest of the snippet should work fine.
Jump to solution
9 Replies
Dennis Koch
Dennis Koch2mo ago
Ideally the password should be in $hidden of your model and not be passed to the frontend? Did you remove that?
Abdur Razzaque
Abdur Razzaque2mo ago
Yes! Without removing, it's not showing the form.
Dennis Koch
Dennis Koch2mo ago
So that's solved? Or is there a valid reason why you need it to be non-hidden?
Abdur Razzaque
Abdur Razzaque2mo ago
This now showing the encrypted hash. It should be show the correct password. I mean decrypted hash password.
Dennis Koch
Dennis Koch2mo ago
I mean decrypted hash password.
There is no such thing as a "decrypted hash". Hashes aren't meant to be decrypted.
Abdur Razzaque
Abdur Razzaque2mo ago
So if I add again the hidden on model and if I take the password filed empty to take the older password, maybe it will be right thing. Am I right?
Solution
Dennis Koch
Dennis Koch2mo ago
Make it hidden. The rest of the snippet should work fine.
Dennis Koch
Dennis Koch2mo ago
People can adjust their password if they add a new one. But the old one shouldn’t be showing
Abdur Razzaque
Abdur Razzaque2mo ago
Thank you ♥️
Want results from more Discord servers?
Add your server
More Posts