Skip to content

Commit 1748e10

Browse files
committed
[Validator] Update the name of a password strength level
1 parent cbfaca2 commit 1748e10

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

Constraints/PasswordStrength.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ final class PasswordStrength extends Constraint
2626
{
2727
public const STRENGTH_VERY_WEAK = 0;
2828
public const STRENGTH_WEAK = 1;
29-
public const STRENGTH_REASONABLE = 2;
29+
public const STRENGTH_MEDIUM = 2;
3030
public const STRENGTH_STRONG = 3;
3131
public const STRENGTH_VERY_STRONG = 4;
3232

@@ -42,7 +42,7 @@ final class PasswordStrength extends Constraint
4242

4343
public function __construct(array $options = null, int $minScore = null, array $groups = null, mixed $payload = null)
4444
{
45-
$options['minScore'] ??= self::STRENGTH_REASONABLE;
45+
$options['minScore'] ??= self::STRENGTH_MEDIUM;
4646

4747
parent::__construct($options, $groups, $payload);
4848

Constraints/PasswordStrengthValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ private static function estimateStrength(#[\SensitiveParameter] string $password
8282
return match (true) {
8383
$entropy >= 120 => PasswordStrength::STRENGTH_VERY_STRONG,
8484
$entropy >= 100 => PasswordStrength::STRENGTH_STRONG,
85-
$entropy >= 80 => PasswordStrength::STRENGTH_REASONABLE,
85+
$entropy >= 80 => PasswordStrength::STRENGTH_MEDIUM,
8686
$entropy >= 60 => PasswordStrength::STRENGTH_WEAK,
8787
default => PasswordStrength::STRENGTH_VERY_WEAK,
8888
};

Tests/Constraints/PasswordStrengthValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function testValidValues(string $value, int $expectedStrength)
4545
public static function getValidValues(): iterable
4646
{
4747
yield ['How-is-this', PasswordStrength::STRENGTH_WEAK];
48-
yield ['Reasonable-pwd', PasswordStrength::STRENGTH_REASONABLE];
48+
yield ['Reasonable-pwd', PasswordStrength::STRENGTH_MEDIUM];
4949
yield ['This 1s a very g00d Pa55word! ;-)', PasswordStrength::STRENGTH_VERY_STRONG];
5050
yield ['pudding-smack-👌🏼-fox-😎', PasswordStrength::STRENGTH_VERY_STRONG];
5151
}

0 commit comments

Comments
 (0)