Skip to content

Commit

Permalink
fix user profile empty after registration
Browse files Browse the repository at this point in the history
  • Loading branch information
pozylon committed Sep 27, 2019
1 parent 4f7cfe2 commit dc25fe3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
7 changes: 6 additions & 1 deletion packages/core-users/db/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ Meteor.users.attachSchema(
birthday: Date,
phoneMobile: String,
gender: String,
address: Address
address: Address,
customFields: {
type: Object,
optional: true,
blackbox: true
}
},
{ requiredByDefault: false }
),
Expand Down
3 changes: 2 additions & 1 deletion packages/platform/setup-accounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ Accounts.validateNewUser(user => {

Accounts.onCreateUser((options = {}, user = {}) => {
const newUser = user;
const { guest, skipEmailVerification } = options;
const { guest, skipEmailVerification, profile } = options;

newUser.profile = profile;
newUser.guest = !!guest;
newUser.created = newUser.createdAt || new Date();
delete newUser.createdAt; // comes from the meteor-apollo-accounts stuff
Expand Down
4 changes: 3 additions & 1 deletion tests/auth-anonymous.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ describe('Auth for anonymous users', () => {
}
});
expect(createUser).toMatchObject({
user: {}
user: {
profile: {}
}
});
});
});
Expand Down

0 comments on commit dc25fe3

Please sign in to comment.