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

Allow to configure validator with custom authentication result codes and validation messages #47

Merged
merged 6 commits into from May 14, 2019

Conversation

Projects
None yet
2 participants
@Xerkus
Copy link
Member

commented May 13, 2019

This PR adds feature to configure Authentication validator with user defined authentication result codes and their corresponding validation messages.
Solves #41

  • Are you creating a new feature?
    • Why is the new feature needed? What purpose does it serve?
      Authentication Result allows custom result codes to be specified but Authentication validator does not provide a way to map those codes to meaningful validation error messages. This feature fixes that by introducing new configuration option for Authentication validator.
    • How will users use the new feature?
      New constructor configuration option code_map added. It is an array of [int $resultCode => string $validatorMessageKey].
      Custom validator message key can be specified which is then registered as a new template that can be modified using common ways provided by Zend\Validator\AbstractValidator: setMessage() method or messages option.
    • Base your feature on the develop branch, and submit against that branch.
    • Add only one feature per pull request; split multiple features over multiple pull requests
    • Add tests for the new feature.
    • Add documentation for the new feature.
    • Add a CHANGELOG.md entry for the new feature.

Xerkus added some commits May 13, 2019

@Xerkus Xerkus added the enhancement label May 13, 2019

@Xerkus Xerkus requested a review from weierophinney May 13, 2019

@weierophinney
Copy link
Member

left a comment

Code looks good.

I've flagged a couple documentation changes, and have one question about code types.

Show resolved Hide resolved docs/book/validator.md Outdated
Show resolved Hide resolved docs/book/validator.md Outdated
Show resolved Hide resolved src/Validator/Authentication.php
@Xerkus

This comment has been minimized.

Copy link
Member Author

commented May 14, 2019

@weierophinney I pushed improved documentation for validator that I hope should be more clear.

@weierophinney
Copy link
Member

left a comment

This reads REALLY well, and makes it very clear how everything works!

I've provided a number of suggestions that fix grammar and/or punctuation. You should be able to commit each and/or batch them from the UI (instead of addressing them one-by-one manually).

Show resolved Hide resolved docs/book/validator.md Outdated
Show resolved Hide resolved docs/book/validator.md Outdated
Show resolved Hide resolved docs/book/validator.md Outdated
Show resolved Hide resolved docs/book/validator.md Outdated
Show resolved Hide resolved docs/book/validator.md Outdated
Show resolved Hide resolved docs/book/validator.md Outdated
Show resolved Hide resolved docs/book/validator.md Outdated
Show resolved Hide resolved docs/book/validator.md Outdated
Show resolved Hide resolved docs/book/validator.md Outdated
Show resolved Hide resolved docs/book/validator.md Outdated

Xerkus and others added some commits May 14, 2019

Apply suggestions from code review
Co-Authored-By: Matthew Weier O'Phinney <matthew@weierophinney.net>

@Xerkus Xerkus merged commit 2268e32 into zendframework:develop May 14, 2019

1 check was pending

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details

Xerkus added a commit that referenced this pull request May 14, 2019

@Xerkus Xerkus added this to the 2.7.0 milestone May 14, 2019

@Xerkus Xerkus referenced this pull request May 14, 2019

Closed

Support user-defined error codes #41

7 of 9 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.