bentojs-api-user v1.6.0-beta.1
Bento API User
Setup
# Install npm package
$ npm install bentojs-api-user --save
Hooks
Store Before
Optional
Executes before a user is registered, enables the system to alter client registration data. If this hook is defined remember to encrypt the payload password
.
hooks.set('user:store.before', function *(payload, _user) {
/*
payload : The data payload provided by the client.
_user : The authenticated user making the request if present.
*/
return payload;
});
Store After
Optional
Executes after a successfull user registration.
hooks.set('user:store.after', function *(user, _user) {
/*
user : The newly registered users system data.
_user : The authenticated user that made the registration request.
*/
});
Save Before
Optional
Executes before a user is saved, enables the system to alter client update data. If this hook is defined remember to encrypt the payload password
.
hooks.set('user:save.before', function *(payload, _user) {
/*
payload : The data payload provided by the client.
_user : The authenticated user making the request if present.
*/
return payload;
});
Save After
Optional
Executes after a successfull user update.
hooks.set('user:save.after', function *(user, _user) {
/*
user : The updated user.
_user : The authenticated user that made the registration request.
*/
});
Delete Before
Optional
Executes before a user is deleted.
hooks.set('user:delete.before', function *(payload, _user) {
/*
user : The payload provided by the client.
_user : The authenticated user that made the registration request.
*/
});
Verification
Required
This is a required hook run when a verification request is being processed. If a error is thrown during this hook the verification event is cancelled and can be retried.
hooks.set('user:verification', function *(user, token, result) {
/*
user : The user being verified.
token : The verification token.
result : The data connected to the token, this contains [ 'id', 'type' ].
*/
});
#### [Password Token](#password-token)
_Required_
This is a required hook and is provided by default on a fresh install (from version 1.3.8). It is executed when a new password reset token has been provided.
```js
hooks.set('user:password-token', function *(user, resetUri) {
/*
user : The user account that is request a password reset.
resetUri : The full uri to executed to take the client directly to the password reset window.
*/
});
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago