diff options
author | eug-vs <eug-vs@keemail.me> | 2020-06-22 19:08:35 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2020-06-22 19:09:40 +0300 |
commit | ea35b242da316e75928a0a6d336378ea50f4d6f8 (patch) | |
tree | 46acad0ca0d1eba8432abb6b2b5c33c984268faf | |
parent | 1af98079d43b8bf5da7a32870b7bb60e5f59e554 (diff) | |
download | which-api-ea35b242da316e75928a0a6d336378ea50f4d6f8.tar.gz |
fix: protect password field in ALL calls
-rw-r--r-- | services/users/users.hooks.ts | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/services/users/users.hooks.ts b/services/users/users.hooks.ts index fc17ed7..580d1d2 100644 --- a/services/users/users.hooks.ts +++ b/services/users/users.hooks.ts @@ -1,7 +1,14 @@ import { hooks } from '@feathersjs/authentication-local'; +import { HookContext } from '@feathersjs/feathers'; const hashPassword = hooks.hashPassword('password'); -const protectPassword = hooks.protect('password'); + +const protectPassword = async (context: HookContext): Promise<HookContext> => { + const { dispatch } = hooks.protect('password')(context); + context.result = dispatch; + context.dispatch = dispatch; + return context; +} export default { after: { |