Reputation: 644
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?
Upvotes: 4
Views: 1002
Reputation: 644
The problem is that the Accounts.onCreateUser was running in the client folder. It cannot operate in the client, only on the server.
Upvotes: 7