Skip to content

Commit ea35b24

Browse files
committed
fix: protect password field in ALL calls
1 parent 1af9807 commit ea35b24

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

services/users/users.hooks.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
import { hooks } from '@feathersjs/authentication-local';
2+
import { HookContext } from '@feathersjs/feathers';
23

34
const hashPassword = hooks.hashPassword('password');
4-
const protectPassword = hooks.protect('password');
5+
6+
const protectPassword = async (context: HookContext): Promise<HookContext> => {
7+
const { dispatch } = hooks.protect('password')(context);
8+
context.result = dispatch;
9+
context.dispatch = dispatch;
10+
return context;
11+
}
512

613
export default {
714
after: {

0 commit comments

Comments
 (0)