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

hashPassword in patch #286

Closed
mcchrish opened this Issue Sep 8, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@mcchrish
Copy link

mcchrish commented Sep 8, 2016

This check https://github.com/feathersjs/feathers-authentication/blob/master/src/hooks/hash-password.js#L36-L39 is preventing patch methods if password is not defined in the data.

@marshallswain

This comment has been minimized.

Copy link
Member

marshallswain commented Sep 8, 2016

Yeah. hashPassword should just hash a password if one is available. I made a PR.

cc: @ekryski, @daffl

Looks like I need to update tests, still. But I don't think this should break anything. Am I missing something?

@mcchrish

This comment has been minimized.

Copy link
Author

mcchrish commented Sep 13, 2016

An alternative for now is:

const { hooks } = require('feathers-authentication');

// Your custom hashPassword hook
exports.myHashPassword = function(options) {
  const hashPassword = hooks.hashPassword(options);

  // Add any custom options
  return function(hook) {
    if(hook.data.password !== undefined) {
      // Call the hashPassword hook
      return hashPassword.call(this, hook);
    }
  };
}

Taken from http://docs.feathersjs.com/hooks/usage.html#customizing-built-in-hooks

@daffl daffl closed this in #287 Sep 28, 2016

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.