Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why would Meteor.Accounts return "has no method 'onCreateUser'"?

Tags:

meteor

account

I'm trying to add an accountActive and accountExpirationDate to a user's profile when it is created. According to everything I've read, I should use Accounts.onCreateUser like so:

// Add accountActive and accountExpirationDate
Accounts.onCreateUser(function(options, user) {
  if (options.profile) {
    user.profile = options.profile;
    user.profile.accountActive          =   false;
    user.profile.accountExpirationDate  =   null;
  }
  return user;
});

The two fields are not being added and I'm receiving this error in Console.

Uncaught TypeError: Object #<Object> has no method 'onCreateUser' 

What am I doing wrong?

like image 333
Chris Avatar asked Mar 20 '23 02:03

Chris


1 Answers

The problem is that the Accounts.onCreateUser was running in the client folder. It cannot operate in the client, only on the server.

like image 112
Chris Avatar answered Apr 25 '23 11:04

Chris