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

Expose password validation #4157

Merged
merged 3 commits into from
Sep 21, 2017
Merged

Conversation

export-mike
Copy link
Contributor

extract password validation so users can access the validation within their own code for things like password reset

Description of changes

I've extracted validation as a static method added to the PasswordType, allowing consistent password validation in their own application logic.

In userland you can now access the same logic,

const User = keystone.list('User');
const min = User.fields.password.options.min;
const max = User.fields.password.options.max || 72;
const complexity = User.fields.password.options.complexity;
const { result, detail } = Types.Password.validate(password, confirmPassword, { min, max, complexity });

Whilst this isn't perfect with the amount of boilerplate required. It does allow a user to have access to the same logic.

Testing

  • [Y] Please confirm npm run test-all ran successfully.

… their own code for things like password reset
@export-mike
Copy link
Contributor Author

I'm closing this.

@export-mike export-mike reopened this Aug 15, 2017
@vitalbone
Copy link
Contributor

@Noviny @JedWatson

This is now passing all it's tests. The broken Travis build is related to a dependency not liking the use of const in strict mode 😕

screen shot 2017-09-21 at 12 19 54 pm

Good to go? or more work required? Not sure due to the lack of context on where this issue was left...

@Noviny
Copy link
Contributor

Noviny commented Sep 21, 2017

@vitalbone This dependency is in the tests themselves?

If the tests are failing because they themselves are blocking strict mode then that's a bit ¯\(ツ)

If that's the only problem and has your LGTM, feel free to hit the merge button.

@vitalbone vitalbone merged commit cefe626 into master Sep 21, 2017
@vitalbone vitalbone deleted the feature/extract-password-validation branch September 21, 2017 23:01
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.

3 participants