【发布时间】:2019-01-21 13:24:46
【问题描述】:
我正在使用: 流星版本 1.8, 账户密码@1.5.1
调用时:
Meteor.methods({
setPassword(newPassword, userId) {
check(userId, String);
check(newPassword, String);
if(Meteor.user().isAdmin){
Accounts.setPassword(userId, newPassword);
}
},
});
通过
Meteor.call('setPassword', password, this.userId);
我收到此错误:
Exception while simulating the effect of invoking 'setPassword' TypeError: Accounts.setPassword is not a function
但是密码仍然设置...
【问题讨论】:
-
您的方法是否在“服务器”文件夹中?如果不是,我认为 setPassword 应该在服务器段内,即 'if (Meteor.isServer) {..//your setPassword method}'