I can’t say I was offended - code annotation should be exempt!
So, I’m trying to replicate your problem (not succeeded in getting it to fail so far). Here’s what I did:
Set up a new app and add in account-password.
meteor create play
cd play
meteor npm i
meteor add accounts-password
Set up server/main.js
import { Meteor } from 'meteor/meteor';
import { Accounts } from 'meteor/accounts-base';
Meteor.startup(() => {
Accounts.onCreateUser(function(options, user) {
if (options.profile) {
user.profile = options.profile;
} else {
user.profile = {};
}
user.profile.thing = {a:1,b:2};
console.log(user, options);
return user;
});
});
Set up client/main.html
<head>
<title>play</title>
</head>
<body>
</body>
Start the app areate a new user through the Chrome console:
meteor&
> Accounts.createUser({username:'bobby',email:'bobby@bobson.com',password:'bobby'});
Observe console.log
:
I20160722-11:01:39.106(1)? { createdAt: Fri Jul 22 2016 11:01:39 GMT+0100 (BST),
I20160722-11:01:39.107(1)? _id: 'Kq6yop7MunkN25PPF',
I20160722-11:01:39.107(1)? services: { password: { bcrypt: '$2a$10$e5EStGJHX.kY9j5iJm5qbun9iqstj.RmWgBG9Q8SXiOIdlib10bR2' } },
I20160722-11:01:39.108(1)? username: 'bobby',
I20160722-11:01:39.108(1)? emails: [ { address: 'bobby@bobson.com', verified: false } ],
I20160722-11:01:39.108(1)? profile: { thing: { a: 1, b: 2 } } } { username: 'bobby',
I20160722-11:01:39.109(1)? email: 'bobby@bobson.com',
I20160722-11:01:39.109(1)? password:
I20160722-11:01:39.110(1)? { digest: '69ff8042237aeef5ddf1ced10e851bc6104e1ebb15a304061dba43ea10106fa9',
I20160722-11:01:39.110(1)? algorithm: 'sha-256' } }
Add accounts-ui
meteor add accounts-ui
Add loginButtons
to client/main.html
:
<head>
<title>play</title>
</head>
<body>
{{> loginButtons}}
</body>
Create a new user through the loginButtons
ui:
Observe console.log
:
I20160722-11:04:04.267(1)? { createdAt: Fri Jul 22 2016 11:04:04 GMT+0100 (BST),
I20160722-11:04:04.284(1)? _id: 'RphM4g8DqAmBJgHfx',
I20160722-11:04:04.287(1)? services: { password: { bcrypt: '$2a$10$0Oa7uWLsueuzJVdAGj9ZlO.yQxB4t4m3xyIDOg9.Vy15ithp1RdZq' } },
I20160722-11:04:04.289(1)? emails: [ { address: 'betty@bobson.com', verified: false } ],
I20160722-11:04:04.291(1)? profile: { thing: { a: 1, b: 2 } } } { email: 'betty@bobson.com',
I20160722-11:04:04.293(1)? password:
I20160722-11:04:04.294(1)? { digest: '25eb140a5d07827aa95cec021a994705e5d94188b416ba1b166c8a062b3f694f',
I20160722-11:04:04.295(1)? algorithm: 'sha-256' } }
So, maybe the difference is in the location of your Accounts.onCreateUser
- is your util.js
executed in a Meteor.startup
?