Allow to disable digits in Faker::Internet.password method#3033
Conversation
2313e3f to
17967e3
Compare
This change allows to allow or not digits inside the password. If `digits: true`, a digit is automatically added.
17967e3 to
4a8fb7b
Compare
|
What is the use case for passwords without a digit? I am not sure that's something popular enough to be supported here. If that functionality is needed, it seems best to me to use |
|
Thanks for the answer! To be completely honest, I thought it would be useful to have such thing when working on #3034, because a digit is always added (leading to a wrong required length). I believe it might happen that you don't want to have one. I don't know all the use cases obviously, but I don't see the harm supporting it. Is there a specific reason why we wouldn't want to allow that? Faker::Alphanumeric.alphanumeric looks like a great alternative, but doesn't offer the special characters nor the uppercase letters. Let me know if I missed something, or if I can help with anything else! |
|
Faker is currently focused on performance and organization of all the existing generators. We already have a lot of generators, and adding one more feature adds to the complexity of focusing on our goal. One of our projects is to allow extensible plugins where the community can create plugins for niche scenarios like this one, and the creator maintains it instead of us. Bugs are still valid. I will review the bug this week. |
|
Hi @francktrouillez Thanks for your contribution and replying back. I know working on Open Source requires valuable time. At the moment, we won't accept this because we are not introducing new/significant changes to existing generators. @thdaraujo and I are currently exploring different ways of loading the generators with the expectation to give the community the option to create their own generators/custom options without merging them in faker. This would reduce our load (we have lots of generators to update, maintain, etc.) while providing flexibility to users by adding external plugins. Once we have this going, I will let you know and you can contribute to faker by adding this option as a plugin. |
Motivation / Background
Currently, a
digitis always added to the string generated byFaker::Interner.password. There's currently no way to disable this behavior.Also, with the current behavior, running
Faker::Internet.password(min_length: 2, max_length: 2, mix_case: true)will return a password of length 3, as a digit is always added to the string, in addition to the uppercase and lowercase letters.Changes proposed in this pull request
This PR allows to disable the use of digits (and the auto-addition of one) when generating passwords. By default, a digit is added, but this can be disabled by setting the
digitsoption tofalse. Also, when thedigitsoption is set totrue(current and default behavior), the required length of the password is updated to reflect the presence of the digit.Checklist
Before submitting the PR make sure the following are checked:
[Fix #issue-number]If you're proposing a new generator or locale:
[ ] Double-check the existing generators documentation to make sure the new generator you want to add doesn't already exist.[ ] You've reviewed and followed the Contributing guidelines.Closing notes
I'm open to any feedback or suggestions on how to improve this PR if this idea makes sense.
Thank you very much!