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
Ability to set max length of HumanPasswordGenerator #12
Comments
I believe I already have the option to set min and max length of the words. The default is between 3 and 20 characters. An example would be configured like this:
|
Right, I know. But I can't get a 20 char password consisting of 3 or more random words with the above. As far as I can tell, anyway. |
I'll have a think. It'll be possible to limit the password length. |
I've added a branch with all the boiler plate code. If you can think of a good way to generate a password of a fixed length, then I'm open to suggestions. HumanPasswordGenerator.php#L123 This is my current work in progress. $desiredLength = $this->getLength() || $this->getMaxPasswordLength();
for ($i = 0; $i < $wordCount; $i++) {
if ($i) {
$password .= $this->getWordSeparator();
}
if ($this->getLength()) {
$minLength = $this->getMinWordLength();
$maxLength = $this->getMaxWordLength();
$password .= $this->randomWord($minLength, $maxLength);
} else {
$password .= $this->randomWord();
}
} |
This feature is currently in the develop branch, waiting for release. Though I need to tweak it. |
In release 1.2.0 |
You can set the number of words, but it would be nice if you could set the minimum length of the words, and the max length of the password.
Or be able to set the max length of the password, and the minimum number of words in it.
The text was updated successfully, but these errors were encountered: