Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Form] Skip password hashing on empty password#49459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| $form =$this->factory | ||
| ->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType',$user) | ||
| ->add('plainPassword','Symfony\Component\Form\Extension\Core\Type\PasswordType', [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
let's use ::class even if some other test cases don't
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Done
| publicfunctionregisterPassword(FormEvent$event) | ||
| { | ||
| if ('' ===$event->getData()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Should we account fornull too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Done
89b37a1 tob4aa3eaComparenicolas-grekas commentedFeb 21, 2023
Thank you@Seb33300. |
Uh oh!
There was an error while loading.Please reload this page.
When using the new
hash_property_pathoption to hash password submitted by forms, we should skip hashing if the submitted password is empty.Because empty passwords are not allowed and saving an empty password hash will prevent the user to login his account:
symfony/src/Symfony/Component/Security/Http/EventListener/CheckCredentialsListener.php
Lines 59 to 62 in8c19af2
Because a common use case when creating a user profile form is to ignore the "new password" input if it's left blank.