We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d1d4eff commit c374f5fCopy full SHA for c374f5f
src/Security/Password.php
@@ -33,9 +33,19 @@ final class Password
33
* @param bool $special
34
* @return string
35
*/
36
- public static function generate(int $length = self::LENGTH, bool $special = true) : string
+ public static function generate(int $length = self::LENGTH, bool $special = false) : string
37
{
38
- return Tokenizer::generate($length, $special);
+ $token = '';
39
+ $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
40
+ $chars .= 'abcdefghijklmnopqrstuvwxyz';
41
+ $chars .= '0123456789';
42
+ if ( $special ) {
43
+ $chars .= '!#$%&()*+,-.:;<>?@[]^{}~';
44
+ }
45
+ for ($i = 0; $i < $length; $i++) {
46
+ $token .= $chars[Tokenizer::range(0, strlen($chars))];
47
48
+ return $token;
49
}
50
51
/**
0 commit comments