Fixes #2659, security issue with required password change.

pull/2710/head
Marcelo Schmidt 10 years ago
parent 22e2f543cb
commit 1d217aac05
  1. 1
      packages/rocketchat-lib/package.js
  2. 9
      packages/rocketchat-lib/server/methods/clearRequirePasswordChange.js
  3. 11
      packages/rocketchat-ui-login/reset-password/resetPassword.js
  4. 1
      server/methods/setUserPassword.coffee

@ -78,7 +78,6 @@ Package.onUse(function(api) {
// SERVER METHODS
api.addFiles('server/methods/addOAuthService.coffee', 'server');
api.addFiles('server/methods/checkRegistrationSecretURL.coffee', 'server');
api.addFiles('server/methods/clearRequirePasswordChange.js', 'server');
api.addFiles('server/methods/deleteUserOwnAccount.js', 'server');
api.addFiles('server/methods/joinDefaultChannels.coffee', 'server');
api.addFiles('server/methods/removeOAuthService.coffee', 'server');

@ -1,9 +0,0 @@
Meteor.methods({
clearRequirePasswordChange: function() {
if (!Meteor.userId()) {
throw new Meteor.Error('invalid-user', '[methods] clearRequirePasswordChange -> Invalid user');
}
return RocketChat.models.Users.unsetRequirePasswordChange(Meteor.userId());
}
});

@ -28,11 +28,6 @@ Template.resetPassword.events({
title: t('Error_changing_password'),
type: 'error'
});
} else {
Meteor.call('clearRequirePasswordChange', function() {
FlowRouter.go('home');
toastr.success(t('Password_changed_successfully'));
});
}
});
} else {
@ -45,10 +40,8 @@ Template.resetPassword.events({
type: 'error'
});
} else {
Meteor.call('clearRequirePasswordChange', function() {
FlowRouter.go('home');
toastr.success(t('Password_changed_successfully'));
});
FlowRouter.go('home');
toastr.success(t('Password_changed_successfully'));
}
});
}

@ -8,5 +8,6 @@ Meteor.methods
throw new Meteor.Error 'not-authorized', '[methods] setUserPassword -> Not authorized'
Accounts.setPassword(Meteor.userId(), password, { logout: false });
return RocketChat.models.Users.unsetRequirePasswordChange(Meteor.userId());
return true;
Loading…
Cancel
Save