Skip to content

Commit

Permalink
Merge pull request #365 from nextcloud/backport/363/stable23
Browse files Browse the repository at this point in the history
[stable23] Shuffle before validating
  • Loading branch information
nickvergessen authored Jun 30, 2022
2 parents 0bfb0a2 + 87dfe5e commit 74665d5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ public function generate(): string {

$password .= $chars = $this->random->generate($length, $chars);

// Shuffle string so the order is random
$password = str_shuffle($password);

try {
$this->validator->validate($password);

Expand All @@ -108,9 +111,6 @@ public function generate(): string {
throw new HintException('Could not generate a valid password');
}

// Shuffle string so the order is random
$password = str_shuffle($password);

return $password;
}
}

0 comments on commit 74665d5

Please sign in to comment.