Skip to content
Snippets Groups Projects
Unverified Commit 66e8c508 authored by Rodrigo Nascimento's avatar Rodrigo Nascimento
Browse files

Prevent reevaluate `Meteor.userId()`

parent 43035dd0
Loading
......@@ -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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment