Skip to content

Cannot specify passwordPolicy.validatorPattern or passwordPolicy.validatorCallback in a configuration file #3302

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

Closed
dkarviga opened this issue Dec 30, 2016 · 11 comments

Comments

@dkarviga
Copy link

Issue Description

I am using the standalone version of parse-server. It seems there is no way to specify passwordPolicy.validatorPattern and passwordPolicy.validatorCallback options via JSON configuration file because these options require being RegExp instance or a function.

I get following errors when I try to specify them:

  • passwordPolicy.validatorPattern must be a RegExp
  • passwordPolicy.validatorCallback must be a function

Is there a way to do it?

Environment Setup

  • Server
    • parse-server version: 2.15.9
    • Operating System: Windows 7
    • Localhost
@cherukumilli
Copy link
Contributor

@dkarviga
The password policy feature was added only in 2.2.25. Can you please try using parse-server 2.2.25 or greater?

@bhaskaryasa, the author of the password policy feature can answer your questions if this feature is not working even after upgrading to 2.2.25 or greater.

@bhaskaryasa
Copy link
Contributor

@dkarviga - The configuration requires these settings to be of exact types. Can you please post the code snippet where ParseServer is being initialised with these settings?

@dkarviga
Copy link
Author

dkarviga commented Jan 5, 2017

@bhaskaryasa
Sorry for the delay. I use parse-server as standalone app (without express framework).

There is a way to initialize parse-server using JSON file.
I run parse-server using the following command:

parse-server =path to config file=

The example of config file

{ "appId": "<app id>", "masterKey": "<master key>", "port": 1337, "databaseURI": "<database url>", "push" : { "android" : { "senderId" : <sender id>, "apiKey" : "<api key>" } }, "cloud": "<path to main.js>", "logsFolder": "<logs folder>", "logLevel": "error", "loggerAdapter": { "module": "parse-server/lib/Adapters/Logger/WinstonLoggerAdapter", "options": { "logLevel": "error" } }, "passwordPolicy" : { "validatorPattern" : ..., "validatorCallback" : .. } }

I cannot specify objects and functions via JSON file, so it seems this functionality cannot be used with standalone apps.

All I need is to add min-length validation for the password.

Currently, as a workaround, I use beforeSave trigger, but in this case, no error message is displayed in the Password Reset form when the user enters an incorrect password.

@dkarviga
Copy link
Author

dkarviga commented Jan 5, 2017

@bhaskaryasa

It would be great if validatorPattern can be casted from string to RegExp, for example

@bhaskaryasa
Copy link
Contributor

@dkarviga - I understand it now. Will look at adding this option. Thanks for the feedback.

@apekelnik
Copy link

@bhaskaryasa, could you say, when we can expect this working?

@bhaskaryasa
Copy link
Contributor

@apekelnik - hoping I can push this change by next release. not sure about the release schedule though.

@apekelnik
Copy link

@bhaskaryasa , thanks. We will be waiting.

@natanrolnik
Copy link
Contributor

Closing, as #3331 was just merged. Release is coming soon.

@bhaskaryasa
Copy link
Contributor

@dkarviga @apekelnik
I hope today's release addresses your need.

@apekelnik
Copy link

@bhaskaryasa thanks.

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

5 participants