- 在使用meteor進行用戶密碼修改設置時,取來的當前的用戶信息並不包含密碼字段,需要在server部分加上如下發布信息,即可獲取到全部用戶信息字段;
Meteor.publish("getUserData", function () {
return Meteor.users.find({_id: this.userId});
});
Meteor.subscribe('getUserData');
Meteor.user() //此時的用戶信息裏包含密碼信息
import { Accounts } from 'meteor/accounts-base'
Accounts.changePassword(oldPassword, newPassword, [callback]);