Skip to content

Commit ef94c64

Browse files
committed
fix: protect only local 'get' queries
1 parent ea35b24 commit ef94c64

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

services/users/users.hooks.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@ import { HookContext } from '@feathersjs/feathers';
33

44
const hashPassword = hooks.hashPassword('password');
55

6-
const protectPassword = async (context: HookContext): Promise<HookContext> => {
7-
const { dispatch } = hooks.protect('password')(context);
8-
context.result = dispatch;
9-
context.dispatch = dispatch;
6+
const localDispatch = async (context: HookContext): Promise<HookContext> => {
7+
context.result = context.dispatch;
108
return context;
119
}
1210

1311
export default {
1412
after: {
15-
all: [protectPassword]
13+
all: [hooks.protect('password')],
14+
get: [localDispatch] // Protect password from local get's
1615
},
1716
before: {
1817
create: [hashPassword],

0 commit comments

Comments
 (0)