Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// ! code: before
all: [],
find: [ authenticate('jwt'), mongoKeys(ObjectID, foreignKeys) ],
get: [ authenticate('jwt') ],
create: [ hashPassword() ],
update: [ hashPassword(), authenticate('jwt') ],
patch: [ hashPassword(), authenticate('jwt') ],
remove: [ authenticate('jwt') ]
// !end
},
after: {
// Your hooks should include:
// all : protect('password') /* Must always be the last hook */
// ! code: after
all: [ protect('password') /* Must always be the last hook */ ],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: []
// !end
},
error: {
// ! code: error
all: [],
find: [],
get: [],
create: [],
update: [],
// ! code: before
all: [],
find: [ authenticate('jwt') ],
get: [ authenticate('jwt') ],
create: [ hashPassword() ],
update: [ hashPassword(), authenticate('jwt') ],
patch: [ hashPassword(), authenticate('jwt') ],
remove: [ authenticate('jwt') ]
// !end
},
after: {
// Your hooks should include:
// all : protect('password') /* Must always be the last hook */
// ! code: after
all: [ protect('password') /* Must always be the last hook */ ],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: []
// !end
},
error: {
// ! code: error
all: [],
find: [],
get: [],
create: [],
update: [],
// ! code: before
all: [],
find: [ authenticate('jwt') ],
get: [ authenticate('jwt') ],
create: [ hashPassword() ],
update: [ hashPassword(), authenticate('jwt') ],
patch: [ hashPassword(), authenticate('jwt') ],
remove: [ authenticate('jwt') ]
// !end
},
after: {
// Your hooks should include:
// all : protect('password') /* Must always be the last hook */
// ! code: after
all: [ protect('password') /* Must always be the last hook */ ],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: []
// !end
},
error: {
// ! code: error
all: [],
find: [],
get: [],
create: [],
update: [],
// ! code: before
all: [],
find: [ authenticate('jwt') ],
get: [ authenticate('jwt') ],
create: [ hashPassword() ],
update: [ hashPassword(), authenticate('jwt') ],
patch: [ hashPassword(), authenticate('jwt') ],
remove: [ authenticate('jwt') ]
// !end
},
after: {
// Your hooks should include:
// all : protect('password') /* Must always be the last hook */
// ! code: after
all: [ protect('password') /* Must always be the last hook */ ],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: []
// !end
},
error: {
// ! code: error
all: [],
find: [],
get: [],
create: [],
update: [],
module.exports = {
before: {
all: [],
find: [ authenticate('jwt') ],
get: [ authenticate('jwt') ],
create: [ hashPassword() ],
update: [ hashPassword(), authenticate('jwt') ],
patch: [ hashPassword(), authenticate('jwt') ],
remove: [ authenticate('jwt') ]
},
after: {
all: [
// Make sure the password field is never sent to the client
// Always must be the last hook
protect('password')
],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: []
},
error: {
all: [],
find: [],
get: [],
create: [],
update: [],
patch: [],
const { newPassword } = ctx.data
if (invalidStr(newPassword)) invalid('newPassword')
ctx.data = { password: newPassword }
await hashPassword()(ctx)
ctx.app.authLimit.resetKey(ctx.params.ip)
return ctx
},
],
remove: [authenticate('jwt'), adminOnly],
},
after: {
all: [
// Make sure the password field is never sent to the client
// Always must be the last hook
protect('password'),
],
find: [],
get: [],
create: [
async ctx => {
const { app } = ctx
if (app.get('didSetup')) return ctx
app.set('didSetup', true)
fs.writeFileSync(
// create empty file so we cant stat it
path.join(__dirname, '..', '..', '..', 'db', '.didSetup'),
''
)
return ctx
},
],
module.exports = {
before: {
all: [
],
find: [ ],
get: [ ],
create: [ hashPassword() ],
update: [ hashPassword() ],
patch: [ hashPassword() ],
remove: [ ]
},
after: {
all: [
protect('password')
],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: []
},
error: {
all: [],
find: [],
get: [],
create: [],
update: [],
patch: [],
const sendVerificationEmail = require('./hooks/send-verification-email');
const restrictUserRole = require('./hooks/restrict-user-role');
const createAdmin = require('./hooks/create-admin');
const createSlug = require('../../hooks/create-slug');
const thumbnails = require('../../hooks/thumbnails');
const isModerator = require('../../hooks/is-moderator-boolean');
const isSingleItem = require('../../hooks/is-single-item');
const inviteCode = require('./hooks/invite-code')();
const search = require('feathers-mongodb-fuzzy-search');
const isOwnEntry = require('./hooks/is-own-entry');
const removeAllRelatedUserData = require('./hooks/remove-all-related-user-data');
const { hashPassword } = require('@feathersjs/authentication-local').hooks;
const cleanupBasicData = protect('password', '_computed', 'verifyExpires', 'resetExpires', 'verifyChanges');
const cleanupPersonalData = protect('email', 'verifyToken', 'verifyShortToken', 'doiToken', 'systemNotificationsSeen');
const restrict = [
restrictToOwner({
idField: '_id',
ownerField: '_id'
})
];
const badgesSchema = {
include: {
service: 'badges',
nameAs: 'badges',
parentField: 'badgeIds',
childField: '_id',
asArray: true
isVerified(),
restrictToOwner()
)
)
]
},
after: {
all: [
xss({ fields: xssFields }),
keepDeletedDataFields(),
discard('wasSeeded')
],
find: [
populate({ schema: userSchema }),
protect('content', 'badgeIds'),
concealBlacklistedData({
data: {
content: 'Comments of this blacklisted user are not visible.',
contentExcerpt: 'Comments of this blacklisted user are not visible.',
hasMore: false
}
})
],
get: [
populate({ schema: userSchema }),
concealBlacklistedData({
data: {
content: 'Comments of this blacklisted user are not visible.',
contentExcerpt: 'Comments of this blacklisted user are not visible.',
hasMore: false
}
module.exports = {
before: {
all: [],
find: [ authenticate('jwt') ],
get: [ authenticate('jwt') ],
create: [hashPassword(), gravatar()],
update: [ authenticate('jwt') ],
patch: [ authenticate('jwt') ],
remove: [ authenticate('jwt') ]
},
after: {
all: [
commonHooks.when(
hook => hook.params.provider,
protect('password')
)
],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: []
},
error: {
all: [],
find: [],
get: [],
create: [],
update: [],