hackzilla / password-generator

PHP Library to generate random passwords
https://hackzilla.org
MIT License
293 stars 37 forks source link

Cannot set my own special symbols #36

Closed patrikvalentaa closed 1 year ago

patrikvalentaa commented 3 years ago

Hi, I cannot add my own symbols, is it possible someway? I tried to defined own option and parameter to it $generator ->setLength(25) ->setOptionValue(RequirementPasswordGenerator::OPTION_UPPER_CASE, true) ->setOptionValue(RequirementPasswordGenerator::OPTION_LOWER_CASE, true) ->setOptionValue(RequirementPasswordGenerator::OPTION_NUMBERS, true) ->setOption($symbols, array('type' => Option::TYPEBOOLEAN, 'default' => false)) ->setParameter($symbols, '!@#$%^&*?~-,.+') ->setOptionValue($symbols, true)

but i allways get Hackzilla\PasswordGenerator\Exception\InvalidOptionException. Is there some way to defined it? I need to generate password with specifical symbols. Thanks

hackzilla commented 3 years ago

I'm not sure what @symbols contains, but you want to set it like this.

$generator->setParameter(self::PARAMETER_SYMBOLS, '!@$%^&*()<>,.?/[]{}-=_+')

You can find more information in #21