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

getPasswordPolicy Throws Error Because of Missing Token (Even When No Token **Can** Be Provided) #22495

Open
einfallstoll opened this issue Jun 28, 2021 · 0 comments

Comments

@einfallstoll
Copy link

Description:

Steps to reproduce:

  1. Disable Accounts_TwoFactorAuthentication_By_Email_Enabled
  2. Create user via API
  3. First login using credentials

Expected behavior:

Password policy should be shown

Actual behavior:

An error [undefined] will be shown:

image

Relevant Request:

{"message":"{\"msg\":\"method\",\"method\":\"getPasswordPolicy\",\"params\":[{}],\"id\":\"12\"}"}

Relevant Response:

{"message":"{\"msg\":\"result\",\"id\":\"12\",\"error\":{\"message\":\"Match error: Missing key 'token'\",\"path\":\"\",\"sanitizedError\":{\"isClientSafe\":true,\"error\":400,\"reason\":\"Match failed\",\"message\":\"Match failed [400]\",\"errorType\":\"Meteor.Error\"},\"errorType\":\"Match.Error\"}}","success":true}

Server Setup Information:

  • Version of Rocket.Chat Server: 3.15.1 (but 3.16.0 as well)
  • Operating System: not relevant
  • Deployment Method: docker
  • Number of Running Instances: not relevant
  • DB Replicaset Oplog: not relevant
  • NodeJS Version: not relevant
  • MongoDB Version: not relevant

Client Setup Information

  • Desktop App or Browser Version: not relevant
  • Operating System: not relevant

Additional context

Relevant code:
https://github.com/RocketChat/Rocket.Chat/blob/master/server/methods/getPasswordPolicy.js#L8-L17

As the user does not perform a regular password reset but login for the first time, a token is not provided, therefore an error is thrown. From my point of view checking the existence of a user (using a password reset token) is superfluous and could be completely removed (correct me if I'm wrong).

Also, I think a proper error message would be helpful as well.

Relevant logs:

not relevant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant