diff options
author | Anna Larch <anna@nextcloud.com> | 2022-06-29 19:32:52 +0300 |
---|---|---|
committer | Anna Larch <anna@nextcloud.com> | 2022-06-29 19:32:52 +0300 |
commit | 7268aa8f68983ea384873eb8d758baa2f022d739 (patch) | |
tree | a055b278d3470e7dcf9d97a415bf1e13989cb6e8 | |
parent | f98c602efb54952713c8195fc23dcf0b96a554d4 (diff) |
Shuffle before validatingenh/shuffle-before-validation
Signed-off-by: Anna Larch <anna@nextcloud.com>
-rw-r--r-- | lib/Generator.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Generator.php b/lib/Generator.php index ca9ea63..b578b84 100644 --- a/lib/Generator.php +++ b/lib/Generator.php @@ -85,6 +85,9 @@ class Generator { $password .= $chars = $this->random->generate($length, $chars); + // Shuffle string so the order is random + $password = str_shuffle($password); + try { $this->validator->validate($password); @@ -108,9 +111,6 @@ class Generator { throw new HintException('Could not generate a valid password'); } - // Shuffle string so the order is random - $password = str_shuffle($password); - return $password; } } |