Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Hooks for service `users1`. (Can be re-generated.)
const commonHooks = require('feathers-hooks-common');
const { authenticate } = require('@feathersjs/authentication').hooks;
// eslint-disable-next-line no-unused-vars
const { hashPassword, protect } = require('@feathersjs/authentication-local').hooks;
// !code: imports // !end
// ! code: used
// eslint-disable-next-line no-unused-vars
const { iff } = commonHooks;
// eslint-disable-next-line no-unused-vars
const { create, update, patch, validateCreate, validateUpdate, validatePatch } = require('./users-1.validate');
// !end
// !code: init // !end
let moduleExports = {
before: {
// Your hooks should include:
// Hooks for service `nedb2`. (Can be re-generated.)
const commonHooks = require('feathers-hooks-common');
const { authenticate } = require('@feathersjs/authentication').hooks;
// eslint-disable-next-line no-unused-vars
const nedb2Populate = require('./nedb-2.populate');
// !code: imports // !end
// ! code: used
// eslint-disable-next-line no-unused-vars
const { iff } = commonHooks;
// eslint-disable-next-line no-unused-vars
const { create, update, patch, validateCreate, validateUpdate, validatePatch } = require('./nedb-2.validate');
// !end
// !code: init // !end
let moduleExports = {
before: {
// Your hooks should include:
app.service('authentication').hooks({
before: {
create: [
(context) => {
/* Stringify the signature JSON to make the lookup() function in
* passport-local/utils happy
*
* Somewhat related to
* https://github.com/jaredhanson/passport-local/issues/153
*/
if (context.data.signature) {
context.data.password = JSON.stringify(context.data.signature);
}
return context;
},
authentication.hooks.authenticate(['local', 'jwt'])
]
}
});
/*
* Initialize the Sentry backend integration for reporting error telemetry
*/
app.set('sentry', new Sentry(process.env.SENTRY_URL || app.get('sentry').url));
if (process.env.NODE_ENV != 'production') {
app.configure(swagger({
docsPath: '/apidocs',
uiIndex: true,
info: {
title: 'Evergreen Backend APIs',
description:
const { authenticate } = require('@feathersjs/authentication').hooks;
const { iff, unless, isProvider, populate, discard, softDelete, setNow } = require('feathers-hooks-common');
const { protect } = require('@feathersjs/authentication-local').hooks;
const {
//queryWithCurrentUser,
associateCurrentUser,
// restrictToAuthenticated,
restrictToOwner
} = require('feathers-authentication-hooks');
const { isVerified } = require('feathers-authentication-management').hooks;
const createExcerpt = require('../../hooks/create-excerpt');
const patchDeletedData = require('../../hooks/patch-deleted-data');
const concealBlacklistedData = require('../../hooks/conceal-blacklisted-data');
const keepDeletedDataFields = require('../../hooks/keep-deleted-data-fields');
const createNotifications = require('./hooks/create-notifications');
const createMentionNotifications = require('./hooks/create-mention-notifications');
const isModerator = require('../../hooks/is-moderator-boolean');
// Hooks for service `roles`. (Can be re-generated.)
const commonHooks = require('feathers-hooks-common');
const { authenticate } = require('@feathersjs/authentication').hooks;
// !code: imports // !end
// ! code: used
// eslint-disable-next-line no-unused-vars
const { iff } = commonHooks;
// eslint-disable-next-line no-unused-vars
const { create, update, patch, validateCreate, validateUpdate, validatePatch } = require('./roles.validate');
// !end
// !code: init // !end
let moduleExports = {
before: {
// Your hooks should include:
// all : authenticate('jwt')
// ! code: before
// Hooks for service `teams`. (Can be re-generated.)
const commonHooks = require('feathers-hooks-common');
const { authenticate } = require('@feathersjs/authentication').hooks;
// !code: imports // !end
// ! code: used
// eslint-disable-next-line no-unused-vars
const { iff } = commonHooks;
// eslint-disable-next-line no-unused-vars
const { create, update, patch, validateCreate, validateUpdate, validatePatch } = require('./teams.validate');
// !end
// !code: init // !end
let moduleExports = {
before: {
// Your hooks should include:
// all : authenticate('jwt')
// ! code: before
import * as authentication from '@feathersjs/authentication';
import processConfig from '../../hooks/process-config';
import processConfigUpdate from '../../hooks/process-config-update';
import populateUser from '../../hooks/populate-user';
// Don't remove this comment. It's needed to format import lines nicely.
const { authenticate } = authentication.hooks;
export default {
before: {
all: [authenticate('jwt')],
find: [],
get: [],
create: [processConfig()],
update: [processConfigUpdate()],
patch: [processConfigUpdate()],
remove: []
},
after: {
all: [populateUser()],
find: [],
get: [],
const { authenticate } = require('@feathersjs/authentication').hooks;
const createSlug = require('../../hooks/create-slug');
const saveRemoteImages = require('../../hooks/save-remote-images');
module.exports = {
before: {
all: [],
find: [],
get: [],
create: [
authenticate('jwt'),
createSlug({ field: 'name' }),
saveRemoteImages(['logo'])
],
update: [
authenticate('jwt'),
createSlug({ field: 'name' }),
const { associateCurrentUser, restrictToOwner } = require('feathers-authentication-hooks');
const {authenticate} = require('@feathersjs/authentication').hooks;
module.exports = {
before: {
all: [],
find: [],
get: [],
create: [
authenticate('jwt'),
associateCurrentUser()
],
update: [
authenticate('jwt'),
restrictToOwner()
],
patch: [
authenticate('jwt'),
getHooks() {
return {
before: {
all: [
],
find: [
internalOnly,
],
get: [
authentication.hooks.authenticate(['jwt']),
ensureMatchingUUID,
],
create: [
internalApi,
this.checkUpdateFormat,
dbtimestamp('createdAt'),
this.defaultChannel,
this.preventRedundantCommits,
],
update: [
],
patch: [
internalApi,
this.checkUpdateFormat,
this.patchByCommitAndChannel,
dbtimestamp('updatedAt'),