You can override User.hashPassword
to implement your own hashing method.
Let's say you have a model Customer which has User as base model,
Inside customer.js, you can add follwoinng snippet,
Customer.hashPassword = function(plain) {
this.validatePassword(plain);
return plain + '1'; // your hashing algo will come here.
};
This will append 1 to all the passwords.
Now you need to override another function User.prototype.hasPassword
which matches the user input password with the hashed password,
Customer.prototype.hasPassword = function(plain, fn) {
fn = fn || utils.createPromiseCallback();
if (this.password && plain) {
const isMatch = this.password === plain + '1' // same hashing algo to come here.
fn(null, isMatch)
} else {
fn(null, false);
}
return fn.promise;
};