Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[DX] New service to simplify password encoding#11306
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
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.
You could make it more consistent and avoid assignment, just like in theisPasswordValid().
Nek- commentedJul 5, 2014
So you don't think that this comment#11299 (comment) is a great idea ? (just not repeat "password") |
aferrandini commentedJul 5, 2014
@jakzal I've update your comments. Please review it and tell me if I have to change anything else. |
aferrandini commentedJul 5, 2014
@javiereguiluz we could have both methods, one for validate user password as you mention before and another to validate a password, due to could be a password not stored in the user object. publicfunction isPasswordValid(UserInterface$user,$encoded,$raw);publicfunction isUserPasswordValid(UserInterface$user,$raw); |
jakzal commentedJul 5, 2014
👍 for@javiereguiluz comment, password is redundant. @Nek- I think |
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.
PasswordEncoder would be better. We don't use theService suffix (it doesn't bring much value).
aferrandini commentedJul 5, 2014
I forgot to implements the PasswordEncoderServiceInterface. @jakzal I added the Service prefix in order to prevent collision with PasswordEncoderInterface in the same namespace. |
jakzal commentedJul 5, 2014
Do we need an interface here? It's a helper class and is unlikely to be overriden. How about calling the class |
aferrandini commentedJul 5, 2014
@jakzal 👍 to the class name |
aferrandini commentedJul 5, 2014
@jakzal changes made, and also passed the php-cs-fixer hope everything it's ok now |
weaverryan commentedJul 5, 2014
I like this implementation.@aferrandini we should also get a PR (or at least an issue) on |
aferrandini commentedJul 5, 2014
@waverryan of course 👍 |
aferrandini commentedJul 5, 2014
@weaverryan I added a PR to the symfony/symfony-docs repo with documentation. |
weaverryan commentedJul 5, 2014
@aferrandini you're on fire! |
ggam commentedJul 5, 2014
@aferrandini docs link point to the current repository (symfony/symfony). I think you should enter the full url |
aferrandini commentedJul 6, 2014
@ggam updated |
fabpot commentedJul 23, 2014
👍 |
fabpot commentedJul 25, 2014
Thank you@aferrandini. |
…ndini)This PR was merged into the 2.6-dev branch.Discussion----------[DX] New service to simplify password encoding| Q | A| ------------- | ---| Bug fix? | no| New feature? | yes| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#11299| License | MIT| Doc PR |symfony/symfony-docs#3995This new service siplifies the way to encode a password. Just get the `security.password_encoder` service and encode the `User` password.```php$encoded = $this->container->get('security.password_encoder') ->encodePassword($user, $plainPassword);$user->setPassword($encoded);```Commits-------7bc190a New service to simplify password encoding
…dini)This PR was merged into the master branch.Discussion----------[DX] New service to simplify password encoding| Q | A| ------------- | ---| Doc fix? | no| New docs? | [#11306](symfony/symfony#11306)| Applies to | 2.6Add documentation for symfony/symfony PR [#11306](symfony/symfony#11306)New service to simplify password encoding.Commits-------785827f New service to simplify password encoding
This new service siplifies the way to encode a password. Just get the
security.password_encoderservice and encode theUserpassword.