Reputation: 1489
Im using the alanning-roles package, and a Meteor.method to create an account with roles, but the accounts gets created witout any roles.
The browser console throws Internal 505 error
and the server console throws invalid createUser Method.
This is my method.
Meteor.methods({
createUser:function(password,email,username){ //Normal Account
var rol = "Normal",
account = Accounts.createUser({
email:email,
password:password,
username:username
});
console.log(account) //returns id wich i need to add the user to the rol
Roles.addUsersToRoles(account, rol);
return account;
}
})
And calling it like i.e on an event handler.
Meteor.call('createUser',"example123","[email protected]","example",function(error,account){
if(error){
console.log(error.reason)
}else{
console.log("user created")
}
})
Upvotes: 1
Views: 56
Reputation: 11376
Internal 505 error //this means something get wrong on the server, so the Meteor.call is ok.
Also the server method is ok, but you need to wrap the rol inside an array, like this.
var rol = ["Normal"]
The roles fields is like the email field on the Accounts-Package
.
Upvotes: 1