mantrajs / meteor-mantra-kickstarter

Kickstart your meteor mantra development
MIT License
184 stars 50 forks source link

Accounts.onCreateUser not fired #12

Open bright-sea opened 8 years ago

bright-sea commented 8 years ago

I add Accounts.onCreateUser hook in server/main.js, but it never be triggered.

I can see that new user added into database but without onCreateUser logic applied, even server console didn't show anything. Here is code I added on main.js

Accounts.onCreateUser(function(options, user) {

  console.log("server on create user triggered");

  if (options.profile)
    user.profile = options.profile;

  // If this is the first user going into the database, make them an admin
  if (Meteor.users.find().count() === 0)
    user.admin = true;

  return user;
});

Anything I am doing wrong or I am missing at here?

natecox commented 8 years ago

I don't see anything wrong with the call itself. Are you making sure that it's being called in top level code?