Prevent reevaluate `Meteor.userId()`

pull/5802/head
Rodrigo Nascimento 9 years ago
parent 43035dd0ef
commit 66e8c508f6
No known key found for this signature in database
GPG Key ID: 2C85B3AFE75D23F9
  1. 5
      server/methods/setUserPassword.js

@ -2,13 +2,14 @@ Meteor.methods({
setUserPassword(password) {
check(password, String);
if (!Meteor.userId()) {
const userId = Meteor.userId();
if (!userId) {
throw new Meteor.Error('error-invalid-user', 'Invalid user', {
method: 'setUserPassword'
});
}
const userId = Meteor.userId();
const user = RocketChat.models.Users.findOneById(userId);
if (user && user.requirePasswordChange !== true) {

Loading…
Cancel
Save