1
1
// const { authenticate } = require('feathers-authentication').hooks;
2
- const { isProvider, when, iff, discard, populate, disableMultiItemChange, lowerCase } = require ( 'feathers-hooks-common' ) ;
2
+ const { isProvider, when, iff, populate, disableMultiItemChange, lowerCase } = require ( 'feathers-hooks-common' ) ;
3
+ const { protect } = require ( '@feathersjs/authentication-local' ) . hooks ;
3
4
const { restrictToOwner } = require ( 'feathers-authentication-hooks' ) ;
4
5
const { addVerification, removeVerification } = require ( 'feathers-authentication-management' ) . hooks ;
5
6
@@ -17,12 +18,8 @@ const removeAllRelatedUserData = require('./hooks/remove-all-related-user-data')
17
18
18
19
const { hashPassword } = require ( '@feathersjs/authentication-local' ) . hooks ;
19
20
20
- const cleanupBasicData = when ( isProvider ( 'external' ) ,
21
- discard ( 'password' , '_computed' , 'verifyExpires' , 'resetExpires' , 'verifyChanges' )
22
- ) ;
23
- const cleanupPersonalData = when ( isProvider ( 'external' ) ,
24
- discard ( 'email' , 'verifyToken' , 'verifyShortToken' , 'doiToken' , 'systemNotificationsSeen' )
25
- ) ;
21
+ const cleanupBasicData = protect ( 'password' , '_computed' , 'verifyExpires' , 'resetExpires' , 'verifyChanges' ) ;
22
+ const cleanupPersonalData = protect ( 'email' , 'verifyToken' , 'verifyShortToken' , 'doiToken' , 'systemNotificationsSeen' ) ;
26
23
27
24
const restrict = [
28
25
restrictToOwner ( {
0 commit comments