Skip to content

Commit

Permalink
Shuffle before validating
Browse files Browse the repository at this point in the history
Signed-off-by: Anna Larch <anna@nextcloud.com>
  • Loading branch information
miaulalala authored and backportbot-nextcloud[bot] committed Jun 30, 2022
1 parent 0bfb0a2 commit 87dfe5e
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 87dfe5e

Please sign in to comment.