Skip to content

Commit 4a479bf

Browse files
committed
Merge branch '3.2' into 3.3
* 3.2: [Security] Fix wrong term in UserProviderInterface [HttpFoundation] Set meta refresh time to 0 in RedirectResponse content disable inlining deprecated services [Cache] add constructor docblocks for clarity [Security] validate empty passwords again [DI] Remove irrelevant comment from container [TwigBridge] cleaner implementation of the TwigRenderer
2 parents 71ad719 + 57d9161 commit 4a479bf

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

Tests/Validator/Constraints/UserPasswordValidatorTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,29 @@ public function testPasswordIsNotValid()
9090
->assertRaised();
9191
}
9292

93+
/**
94+
* @dataProvider emptyPasswordData
95+
*/
96+
public function testEmptyPasswordsAreNotValid($password)
97+
{
98+
$constraint = new UserPassword(array(
99+
'message' => 'myMessage',
100+
));
101+
102+
$this->validator->validate($password, $constraint);
103+
104+
$this->buildViolation('myMessage')
105+
->assertRaised();
106+
}
107+
108+
public function emptyPasswordData()
109+
{
110+
return array(
111+
array(null),
112+
array(''),
113+
);
114+
}
115+
93116
/**
94117
* @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
95118
*/

User/UserProviderInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ interface UserProviderInterface
4848
public function loadUserByUsername($username);
4949

5050
/**
51-
* Refreshes the user for the account interface.
51+
* Refreshes the user.
5252
*
5353
* It is up to the implementation to decide if the user data should be
5454
* totally reloaded (e.g. from the database), or if the UserInterface
@@ -59,7 +59,7 @@ public function loadUserByUsername($username);
5959
*
6060
* @return UserInterface
6161
*
62-
* @throws UnsupportedUserException if the account is not supported
62+
* @throws UnsupportedUserException if the user is not supported
6363
*/
6464
public function refreshUser(UserInterface $user);
6565

Validator/Constraints/UserPasswordValidator.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ public function validate($password, Constraint $constraint)
4040
}
4141

4242
if (null === $password || '' === $password) {
43+
$this->context->addViolation($constraint->message);
44+
4345
return;
4446
}
4547

0 commit comments

Comments
 (0)