Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] Add UncompromisedVerifier facade and UncompromisedVerifierFake #37446

Closed
wants to merge 1 commit into from

Conversation

pgrenaud
Copy link
Contributor

The NotPwnedVerifier makes HTTP request every time the uncompromised() feature of the Password rule is being used. This might be an undesirable behaviour in some environment, especially in local or testing environment. When the new Password rule was first introduced, some were wondering if there was an easy way to mock the uncompromised() feature.

This PR add the UncompromisedVerifier facade and the UncompromisedVerifierFake, a fake implementation of the UncompromisedVerifier contract. With a facade, we can easily reuse the fake mechanism to swap the instance for the fake one.

While this solution address the initial problem, I'm not sure that this is the right way to go. I'm curious to know if you would think of a better approach and I would gladly implement a different solution.

@taylorotwell
Copy link
Member

Hey there - check out the example here: https://laravel.com/docs/8.x/validation#defining-default-password-rules

It shows how to disable this check in certain environments:

image

@pgrenaud
Copy link
Contributor Author

Oh, I did not see that new feature coming through. It is a way better solution, more flexible and more useful! Thanks for letting me know!

@pgrenaud pgrenaud deleted the uncompromisedverifierfake branch May 21, 2021 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants