Do these methods have server side listener such as onCreateUser? and validateLoginAttempt? where i can catch the request on server and handle it then continue?
It does not.
But you use a strategy like this:
const originalChangePassword = Accounts.changePassword;
Accounts.changePassword = function (oldPassword, newPassword, callback) {
// Custom logic before changing the password
console.log('Password change requested:', this.userId);
// Call the original method
return originalChangePassword.call(this, oldPassword, newPassword, callback);
};
const originalResetPassword = Accounts.resetPassword;
Accounts.resetPassword = function (token, newPassword, callback) {
// Custom logic before resetting the password
console.log('Password reset requested with token:', token);
// Call the original method
return originalResetPassword.call(this, token, newPassword, callback);
};
1 Like