Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Verified property of user is always set to false if not supplied #9719

Merged
merged 7 commits into from
Mar 9, 2018

Conversation

MarcosSpessatto
Copy link
Member

@RocketChat/core
Closes #9718
Added verification before update the user, because was being setting verified property always to false, if was not supplied.

@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-9719 March 7, 2018 20:17 Inactive
@MarcosSpessatto
Copy link
Member Author

Added a new endpoint to prevent any breaking change, which might happen if we modified the users.update enpoint directly.
Could you take a look please, @rodrigok ?

@@ -167,7 +167,9 @@ RocketChat.saveUser = function(userId, userData) {
updateUser.$set.requirePasswordChange = userData.requirePasswordChange;
}

updateUser.$set['emails.0.verified'] = !!userData.verified;
if (userData.verified) {
updateUser.$set['emails.0.verified'] = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't I set as not verified? Shouldn't be more correct to check if userData.verified is boolean and then allow to change, that way we do not require to pass that information but allow admins to revert some mistake.

userData.typedPassword = SHA256(this.bodyParams.data.actualPassword);
}

Meteor.runAsUser(this.bodyParams.userId, () => Meteor.call('saveUserProfile', userData, this.bodyParams.customFields));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That way you are allowing anyone to change other's user information, should run as the authenticated user

email: Match.Maybe(String),
name: Match.Maybe(String),
username: Match.Maybe(String),
actualPassword: Match.Maybe(String),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't be better currentPassword rather than actualPassword ?

@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-9719 March 9, 2018 13:24 Inactive
@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-9719 March 9, 2018 14:57 Inactive
@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-9719 March 9, 2018 15:03 Inactive
@RocketChat RocketChat deleted a comment Mar 9, 2018
@rodrigok rodrigok changed the title [FIX] Fix bug, when update a user. [FIX] Verified property of user is always set to false if not supplied Mar 9, 2018
@rodrigok rodrigok modified the milestones: 0.63.0, 0.62.2 Mar 9, 2018
@rodrigok rodrigok merged commit e571e76 into develop Mar 9, 2018
@rodrigok rodrigok deleted the fix-rest-api-verified-email-update branch March 9, 2018 19:28
rodrigok added a commit that referenced this pull request Mar 9, 2018
…update

[FIX] Verified property of user is always set to false if not supplied
@rodrigok rodrigok mentioned this pull request Mar 9, 2018
@rodrigok rodrigok mentioned this pull request Apr 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants