Hello,
Recently I’ve been trying to add roles to my users. I use the useraccount package and the role package.
I configured useraccount to call a function when a new user is created, using the postSignUpHook hook.
In the hook, everything seems to work since I can retrieve the user’s information. But the role is not added in the database. Yet the documentation ensures that this hook is called when a user is successfully created.
What am I doing wrong?
Here is my code:
"server/account.js"
let myPostSignUpHook = function (userId, info) {
console.log("postSignupHook");
console.log(userId);
console.log(info);
Roles.addUsersToRoles(userId, 'user', Roles.GLOBAL_GROUP);
}
AccountsTemplates.configure({
homeRoutePath: '/',
postSignUpHook: myPostSignUpHook,
});
PS: Roles are already created.