Reputation: 36411
I want to create a user that has no attributes but the ID, it seems I cant do that with Accounts.createUser
since username and password are mandatory. Is there another way?
Upvotes: 0
Views: 659
Reputation: 5273
Method Accounts.createUser
(package accounts-password) uses under the hood method Accounts.insertNewDoc(options, user)
which is server side method from package accounts-base.
You can create your own method :
Meteor.methods({
"customCreateUser":function(options,user){
// returns userId
return Accounts.insertNewDoc(options, user)
}
})
Accounts.insertNewDoc(options, user)
doesn't have limitation to create user only when email
or username
are passed in options
.
However that limitation has Accounts.createUser
:
var username = options.username;
var email = options.email;
if (!username && !email)
throw new Meteor.Error(400, "Need to set a username or email");
Upvotes: 1