aboutsummaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2020-06-22 21:09:14 +0300
committereug-vs <eug-vs@keemail.me>2020-06-22 21:09:14 +0300
commitef94c648b14bd09bf28b8f47ed015b319aa8f0cc (patch)
treea2a7473dba7f70353ffba010a73e37cdecd8ac88 /services
parentea35b242da316e75928a0a6d336378ea50f4d6f8 (diff)
downloadwhich-api-ef94c648b14bd09bf28b8f47ed015b319aa8f0cc.tar.gz
fix: protect only local 'get' queries
Diffstat (limited to 'services')
-rw-r--r--services/users/users.hooks.ts9
1 files changed, 4 insertions, 5 deletions
diff --git a/services/users/users.hooks.ts b/services/users/users.hooks.ts
index 580d1d2..8eecca3 100644
--- a/services/users/users.hooks.ts
+++ b/services/users/users.hooks.ts
@@ -3,16 +3,15 @@ import { HookContext } from '@feathersjs/feathers';
const hashPassword = hooks.hashPassword('password');
-const protectPassword = async (context: HookContext): Promise<HookContext> => {
- const { dispatch } = hooks.protect('password')(context);
- context.result = dispatch;
- context.dispatch = dispatch;
+const localDispatch = async (context: HookContext): Promise<HookContext> => {
+ context.result = context.dispatch;
return context;
}
export default {
after: {
- all: [protectPassword]
+ all: [hooks.protect('password')],
+ get: [localDispatch] // Protect password from local get's
},
before: {
create: [hashPassword],