parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

Specify password requirements on password reset

Open devgeek27 opened this issue 10 years ago • 7 comments

Hi everyone

Is there any way we can set the password requirements for user on reset password? Like 8 characters minimum, 1 capital, 1 number, etc.

Thank you.

devgeek27 avatar Sep 18 '16 23:09 devgeek27

For now we don't have a password policy option. That would be a nice feature.

flovilmart avatar Sep 19 '16 01:09 flovilmart

Hello @flovilmart I'd like to work on this feature. Do you guys have an idea about how should the password policy be?

gbrmachado avatar Oct 15 '16 19:10 gbrmachado

The password policy should be an option when creating the ParseServer instance. I believe we should support:

String, interpolated to regexp Regex Function, that return true / false

What do you think?

flovilmart avatar Oct 15 '16 20:10 flovilmart

Ok. So, basically, the user will specify the password policy on index.js(or other file), and this password policy would be used not only in case of password resets, but also when an user is created.

Right?

gbrmachado avatar Oct 19 '16 14:10 gbrmachado

Yes, whenever a password is being set we need to add validation just before it's getting encrypted.

flovilmart avatar Oct 19 '16 16:10 flovilmart

Cool :) I'm a little bit noob in terms of NodeJs, but what I think I sould do(in technical terms) is:

  1. Create config variables to define the password policy(in index.js):
    • Minimum Password Length
    • Maximum Password Length
    • Minimum number of capital letters
    • Minimum number of numbers
  2. Create a method to compare a string and the password policy. This method should be located in https://github.com/ParsePlatform/parse-server/blob/master/src/password.js
  3. Call the method everytime the password is required, probably in https://github.com/ParsePlatform/parse-server/blob/master/src/Controllers/UserController.js

Are these steps enough?

gbrmachado avatar Oct 19 '16 17:10 gbrmachado

Closing as a PR was merged successfully for this.

montymxb avatar Sep 10 '17 02:09 montymxb