2012-10-18 17:20:20 +09:00
|
|
|
Accounts.onCreateUser(function(options, user){
|
2012-10-18 17:43:03 +09:00
|
|
|
user.profile = options.profile || {};
|
2012-10-01 11:18:05 +10:00
|
|
|
user.karma = 0;
|
2012-10-01 13:08:46 +10:00
|
|
|
|
2012-10-05 14:08:46 +09:00
|
|
|
// users start pending, need to be invited
|
2012-10-05 13:59:40 +09:00
|
|
|
user.isInvited = false
|
2012-10-04 11:53:15 +10:00
|
|
|
|
2012-10-01 11:18:05 +10:00
|
|
|
if (options.email)
|
2012-10-01 13:08:46 +10:00
|
|
|
user.profile.email = options.email;
|
|
|
|
|
|
|
|
if (user.profile.email)
|
|
|
|
user.email_hash = CryptoJS.MD5(user.profile.email.trim().toLowerCase()).toString();
|
2012-10-01 11:18:05 +10:00
|
|
|
|
2012-10-01 13:08:46 +10:00
|
|
|
if (!user.profile.name)
|
|
|
|
user.profile.name = user.username;
|
2012-10-01 11:18:05 +10:00
|
|
|
|
2012-10-18 17:43:03 +09:00
|
|
|
console.log('### user', user)
|
|
|
|
|
2012-10-01 11:18:05 +10:00
|
|
|
return user;
|
2012-10-01 13:08:46 +10:00
|
|
|
});
|
|
|
|
|
|
|
|
// FIXME -- don't use this yet, until a) we are sure it's the right approach
|
|
|
|
// b) we also update their profile at the same time.
|
|
|
|
Meteor.methods({
|
|
|
|
changeEmail: function(newEmail) {
|
|
|
|
Meteor.users.update(Meteor.userId(), {$set: {emails: [{address: newEmail}]}});
|
|
|
|
}
|
2012-09-18 12:21:43 +09:00
|
|
|
});
|