Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
remove: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated(),
auth.restrictToOwner({ ownerField: idName }),
],
};
};
exports.after = {
find: [
hooks.remove('password'),
verifyHooks.removeVerification(),
],
get: [
hooks.remove('password'),
verifyHooks.removeVerification(),
],
create: [
hooks.remove('password'),
emailVerification, // send email to verify the email addr
verifyHooks.removeVerification(),
],
update: [
hooks.remove('password'),
verifyHooks.removeVerification(),
],
patch: [
hooks.remove('password'),
verifyHooks.removeVerification(),
],
remove: [
auth.restrictToAuthenticated(),
],
get: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated(),
auth.restrictToOwner({ ownerField: idName }),
],
create: [
validateSchema.form(schemas.signup, schemas.options), // schema validation
hooks.validateSync(client.signup), // redo redux-form client validation
hooks.validateUsingPromise(values => verifyReset.create( // redo redux-form async
{ action: 'unique', value: { username: values.username, email: values.email } }
)),
hooks.validateUsingCallback(server.signup, { app }), // server validation
hooks.remove('confirmPassword'),
verifyHooks.addVerification(), // set email addr verification info
auth.hashPassword(),
],
update: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated(),
auth.restrictToOwner({ ownerField: idName }),
],
patch: [ // client route /user/rolechange patches roles. todo might check its an admin acct
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated(),
],
remove: [
auth.verifyToken(),
export default function accounts() {
this.use("userstate", new UserStateService())
this.use("accounts", new AccountService())
this.service("userstate").after({
all: [hooks.remove("password", "salt")]
})
this.service("accounts").after({
all: [hooks.remove("password", "salt")]
})
}
get: [isRole(VIEW_USERS)],
create: [isRole(MODIFY_USERS), local.hooks.hashPassword()],
remove: [isRole(MODIFY_USERS), local.hooks.hashPassword()],
update: [isRole(MODIFY_USERS), local.hooks.hashPassword()],
patch: [isRole(MODIFY_USERS), local.hooks.hashPassword()]
})
/*
this.service(USER).before({
find: [hooks.iff()],
get: [hooks.iff()]
})
*/
this.service(USER).after({
all: [hooks.remove("password", "salt")],
patch: [hooks.setUpdatedAt("updatedAt")],
update: [hooks.setUpdatedAt("updatedAt")],
create: [
hooks.setCreatedAt("createdAt"),
hooks.remove("roles", "meta")
]
})
}
export default function accounts() {
this.use("userstate", new UserStateService())
this.use("accounts", new AccountService())
this.use("invitation", new InvitationService())
this.service("userstate").after({
all: [hooks.remove("password", "salt")]
})
this.service("accounts").after({
all: [hooks.remove("password", "salt")]
})
}
})
/*
this.service(USER).before({
find: [hooks.iff()],
get: [hooks.iff()]
})
*/
this.service(USER).after({
all: [hooks.remove("password", "salt")],
patch: [hooks.setUpdatedAt("updatedAt")],
update: [hooks.setUpdatedAt("updatedAt")],
create: [
hooks.setCreatedAt("createdAt"),
hooks.remove("roles", "meta")
]
})
}