aboutsummaryrefslogtreecommitdiff
path: root/services/users/users.hooks.ts
diff options
context:
space:
mode:
Diffstat (limited to 'services/users/users.hooks.ts')
-rw-r--r--services/users/users.hooks.ts16
1 files changed, 16 insertions, 0 deletions
diff --git a/services/users/users.hooks.ts b/services/users/users.hooks.ts
new file mode 100644
index 0000000..fc17ed7
--- /dev/null
+++ b/services/users/users.hooks.ts
@@ -0,0 +1,16 @@
+import { hooks } from '@feathersjs/authentication-local';
+
+const hashPassword = hooks.hashPassword('password');
+const protectPassword = hooks.protect('password');
+
+export default {
+ after: {
+ all: [protectPassword]
+ },
+ before: {
+ create: [hashPassword],
+ patch: [hashPassword],
+ update: [hashPassword]
+ }
+};
+