【发布时间】:2015-06-23 09:02:05
【问题描述】:
我使用alanning-roles 包和 Meteor.method 来创建具有角色的帐户,但创建的帐户没有任何角色。
浏览器控制台抛出Internal 505 error,服务器控制台抛出invalid createUser 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;
}
})
并像在事件处理程序上一样调用它。
Meteor.call('createUser',"example123","example@gmail.com","example",function(error,account){
if(error){
console.log(error.reason)
}else{
console.log("user created")
}
})
【问题讨论】:
标签: javascript meteor roles