oooholdings / nova-password-generator

Random Password Generation Field for Laravel Nova
MIT License
10 stars 4 forks source link

updateRules nullable not working [bug] #14

Closed jodhaakbar closed 2 years ago

jodhaakbar commented 2 years ago

hi @btrsco ,

my code :

 PasswordGenerator::make('Password')
                ->onlyOnForms()
                ->creationRules('required', Rules\Password::defaults())
                ->updateRules('nullable', Rules\Password::defaults()),

when i update the user, and leave blank on password field, PasswordGenerator always update the password field value.

i am using nova 4.

btrsco commented 2 years ago

Thanks for the bug report,

@jodhaakbar when you update the user is this only visually updating in the PasswordGenerator field and/or saving a new value to the database? In the meantime I'll take a look and see if I can duplicate and fix this issue.

jodhaakbar commented 2 years ago

hi @btrsco

i checked on database, password field fill with new value, everytime update the nova form.

btrsco commented 2 years ago

@jodhaakbar thanks for double checking for me, I'm working on fixing some old issues and I'll get to this one later tonight. I'll reach out once the package has been updated.

btrsco commented 2 years ago

@jodhaakbar this bug has been fixed and also added a new chain method saveAsPlainText() that will disable the hashing of the field value when saving to the database. Enjoy the update!

Make sure to update your composer dependencies to get the new release.