Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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

Merged
fabpot merged 1 commit intosymfony:masterfromaferrandini:simplify-password-encoding
Jul 25, 2014
Merged

[DX] New service to simplify password encoding#11306

fabpot merged 1 commit intosymfony:masterfromaferrandini:simplify-password-encoding
Jul 25, 2014

Conversation

@aferrandini
Copy link
Contributor

QA
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#11299
LicenseMIT
Doc PRsymfony/symfony-docs#3995

This new service siplifies the way to encode a password. Just get thesecurity.password_encoder service and encode theUser password.

$encoded =$this->container->get('security.password_encoder')    ->encodePassword($user,$plainPassword);$user->setPassword($encoded);

Copy link
Contributor

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-
Copy link
Contributor

Nek- commentedJul 5, 2014

So you don't think that this comment#11299 (comment) is a great idea ? (just not repeat "password")

@aferrandini
Copy link
ContributorAuthor

@jakzal I've update your comments. Please review it and tell me if I have to change anything else.

@aferrandini
Copy link
ContributorAuthor

@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
Copy link
Contributor

👍 for@javiereguiluz comment, password is redundant.

@Nek- I thinksecurity.password_encoder is a name that reflects the serivce's purpose bettern thansecurity.encoder (what kind of an encoder?). Then, the method names (encodePassword,isPasswordValid) are inline with the encoder factory, so probably what most users would expect.

Copy link
Contributor

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
Copy link
ContributorAuthor

I forgot to implements the PasswordEncoderServiceInterface.

@jakzal I added the Service prefix in order to prevent collision with PasswordEncoderInterface in the same namespace.

@jakzal
Copy link
Contributor

Do we need an interface here? It's a helper class and is unlikely to be overriden.

How about calling the classUserPasswordEncoder?

@aferrandini
Copy link
ContributorAuthor

@jakzal 👍 to the class nameUserPasswordEncoder

@aferrandini
Copy link
ContributorAuthor

@jakzal changes made, and also passed the php-cs-fixer hope everything it's ok now

@weaverryan
Copy link
Member

I like this implementation.@aferrandini we should also get a PR (or at least an issue) onsymfony/symfony-docs for the changes (which will shorten things!). Can you create one of those?

@aferrandini
Copy link
ContributorAuthor

@waverryan of course 👍

@aferrandini
Copy link
ContributorAuthor

@weaverryan I added a PR to the symfony/symfony-docs repo with documentation.

@weaverryan
Copy link
Member

@aferrandini you're on fire!

@ggam
Copy link

ggam commentedJul 5, 2014

@aferrandini docs link point to the current repository (symfony/symfony). I think you should enter the full urlhttps://github.com/symfony/symfony-docs/pull/3995

@aferrandini
Copy link
ContributorAuthor

@ggam updated

@fabpot
Copy link
Member

👍

@fabpot
Copy link
Member

Thank you@aferrandini.

@fabpotfabpot merged commit7bc190a intosymfony:masterJul 25, 2014
fabpot added a commit that referenced this pull requestJul 25, 2014
…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
weaverryan added a commit to symfony/symfony-docs that referenced this pull requestSep 1, 2014
…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
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

DXDX = Developer eXperience (anything that improves the experience of using Symfony)

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

7 participants

@aferrandini@Nek-@jakzal@weaverryan@ggam@fabpot@javiereguiluz

[8]ページ先頭

©2009-2025 Movatter.jp