salix/modules/account/back/methods/account/set-password.js

29 lines
819 B
JavaScript

module.exports = Self => {
Self.remoteMethod('setPassword', {
description: 'Sets the user password',
accessType: 'WRITE',
accepts: [
{
arg: 'id',
type: 'number',
description: 'The user id',
http: {source: 'path'}
}, {
arg: 'newPassword',
type: 'string',
description: 'The new password',
required: true
}
],
http: {
path: `/:id/setPassword`,
verb: 'PATCH'
}
});
Self.setPassword = async function(id, newPassword, options) {
options = typeof options == 'object' ? options : {};
await Self.app.models.VnUser.setPassword(id, newPassword, options);
};
};