Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
app.configure(verifyReset);
app.configure(user);
app.configure(message);
// get client config file
app.use('/config', {
get() {
return Promise.resolve(config.clientConfig);
},
});
// create log entry
app.use('/logs', {
before: {
create: [
tryHook(auth.verifyToken()),
tryHook(auth.populateUser()),
],
},
create({ level, msg, payload }, params) {
const paramsUser = params.user;
if (paramsUser && (paramsUser.email || paramsUser.username)) {
payload.user = payload.user || {};
if (paramsUser.email) {
payload.user.email = paramsUser.email;
}
if (paramsUser.username) {
payload.user.username = paramsUser.username;
}
}
it('returns expected hooks', () => {
assert.equal(restrictToAuthenticated[0].toString(), auth.verifyToken().toString());
assert.equal(restrictToAuthenticated[1].toString(), auth.populateUser().toString());
assert.equal(restrictToAuthenticated[2].toString(),
auth.restrictToAuthenticated().toString());
});
});
it('returns expected hooks', () => {
assert.equal(restrictToAuthenticated[0].toString(), auth.verifyToken().toString());
assert.equal(restrictToAuthenticated[1].toString(), auth.populateUser().toString());
assert.equal(restrictToAuthenticated[2].toString(),
auth.restrictToAuthenticated().toString());
});
});
it('returns expected hooks', () => {
assert.equal(restrictToAuthenticated[0].toString(), auth.verifyToken().toString());
assert.equal(restrictToAuthenticated[1].toString(), auth.populateUser().toString());
assert.equal(restrictToAuthenticated[2].toString(),
auth.restrictToAuthenticated().toString());
});
});
const globalHooks = require('../../../hooks');
const hooks = require('feathers-hooks');
const auth = require('feathers-authentication').hooks;
const gravatar = require('./gravatar');
exports.before = {
all: [],
find: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated()
],
get: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated(),
auth.restrictToOwner({ ownerField: 'id' })
],
create: [
auth.hashPassword(), gravatar()
],
update: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated(),
const globalHooks = require('../../../hooks');
const hooks = require('feathers-hooks');
const auth = require('feathers-authentication').hooks;
const process = require('./process');
const restrictToSender = require('./restrict-to-sender');
const populateSender = hooks.populate('sentBy', {
service: 'users',
field: 'id'
});
exports.before = {
all: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated()
],
find: [],
get: [],
create: [process()],
update: [hooks.remove('sentBy'), restrictToSender()],
patch: [hooks.remove('sentBy'), restrictToSender()],
remove: [restrictToSender()]
};
exports.after = {
all: [],
find: [populateSender],
get: [populateSender],
create: [populateSender],
'use strict';
import resize from './resize';
const globalHooks = require('../../../hooks');
const hooks = require('feathers-hooks');
const auth = require('feathers-authentication').hooks;
const dauria = require('dauria');
const permissionName = 'manageMedia';
exports.before = {
create: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated(),
globalHooks.attachPermissions(),
globalHooks.isEnabled(),
globalHooks.hasPermission(permissionName),
resize()
]
};
exports.after = {
all: [],
find: [],
get: [],
create: [
],
const globalHooks = require('../../../hooks');
const hooks = require('feathers-hooks');
const auth = require('feathers-authentication').hooks;
const permissionName = 'manageMedia';
exports.before = {
all: [],
find: [
],
get: [
],
create: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated(),
globalHooks.attachPermissions(),
globalHooks.isEnabled(),
globalHooks.hasPermission(permissionName)
],
update: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated(),
globalHooks.attachPermissions(),
globalHooks.isEnabled(),
globalHooks.hasPermission(permissionName)
],
patch: [
globalHooks.allowUpsert(),
'use strict';
const globalHooks = require('../../../hooks');
const hooks = require('feathers-hooks');
const auth = require('feathers-authentication').hooks;
const permissionName = 'moderateComments';
exports.before = {
all: [],
find: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated(),
globalHooks.attachPermissions(),
globalHooks.isEnabled(),
globalHooks.hasPermission(permissionName)
],
get: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated(),
globalHooks.attachPermissions(),
globalHooks.hasPermission(permissionName)
],
create: [
auth.verifyToken(),
auth.populateUser(),
const globalHooks = require('../../../hooks');
const hooks = require('feathers-hooks');
const auth = require('feathers-authentication').hooks;
const gravatar = require('./gravatar');
exports.before = {
all: [],
find: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated()
],
get: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated(),
auth.restrictToOwner({ ownerField: 'id' })
],
create: [
auth.hashPassword(), gravatar()
],
update: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated(),
auth.restrictToOwner({ ownerField: 'id' })