Merge branch '2.7' into 2.8
* 2.7: [Security] Fix wrong term in UserProviderInterface [HttpFoundation] Set meta refresh time to 0 in RedirectResponse content [Security] validate empty passwords again [DI] Remove irrelevant comment from container [TwigBridge] cleaner implementation of the TwigRenderer
This commit is contained in:
commit
f49cc11021
@ -19,16 +19,19 @@ use Twig\Environment;
|
|||||||
*/
|
*/
|
||||||
class TwigRenderer extends FormRenderer implements TwigRendererInterface
|
class TwigRenderer extends FormRenderer implements TwigRendererInterface
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @var TwigRendererEngineInterface
|
|
||||||
*/
|
|
||||||
private $engine;
|
|
||||||
|
|
||||||
public function __construct(TwigRendererEngineInterface $engine, $csrfTokenManager = null)
|
public function __construct(TwigRendererEngineInterface $engine, $csrfTokenManager = null)
|
||||||
{
|
{
|
||||||
parent::__construct($engine, $csrfTokenManager);
|
parent::__construct($engine, $csrfTokenManager);
|
||||||
|
}
|
||||||
|
|
||||||
$this->engine = $engine;
|
/**
|
||||||
|
* Returns the engine used by this renderer.
|
||||||
|
*
|
||||||
|
* @return TwigRendererEngineInterface The renderer engine
|
||||||
|
*/
|
||||||
|
public function getEngine()
|
||||||
|
{
|
||||||
|
return parent::getEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -36,6 +39,6 @@ class TwigRenderer extends FormRenderer implements TwigRendererInterface
|
|||||||
*/
|
*/
|
||||||
public function setEnvironment(Environment $environment)
|
public function setEnvironment(Environment $environment)
|
||||||
{
|
{
|
||||||
$this->engine->setEnvironment($environment);
|
$this->getEngine()->setEnvironment($environment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,16 +30,6 @@ use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
|
|||||||
*
|
*
|
||||||
* Parameter and service keys are case insensitive.
|
* Parameter and service keys are case insensitive.
|
||||||
*
|
*
|
||||||
* A service id can contain lowercased letters, digits, underscores, and dots.
|
|
||||||
* Underscores are used to separate words, and dots to group services
|
|
||||||
* under namespaces:
|
|
||||||
*
|
|
||||||
* <ul>
|
|
||||||
* <li>request</li>
|
|
||||||
* <li>mysql_session_storage</li>
|
|
||||||
* <li>symfony.mysql_session_storage</li>
|
|
||||||
* </ul>
|
|
||||||
*
|
|
||||||
* A service can also be defined by creating a method named
|
* A service can also be defined by creating a method named
|
||||||
* getXXXService(), where XXX is the camelized version of the id:
|
* getXXXService(), where XXX is the camelized version of the id:
|
||||||
*
|
*
|
||||||
|
@ -134,8 +134,8 @@ class ContainerTest extends TestCase
|
|||||||
public function testSet()
|
public function testSet()
|
||||||
{
|
{
|
||||||
$sc = new Container();
|
$sc = new Container();
|
||||||
$sc->set('foo', $foo = new \stdClass());
|
$sc->set('._. \\o/', $foo = new \stdClass());
|
||||||
$this->assertSame($foo, $sc->get('foo'), '->set() sets a service');
|
$this->assertSame($foo, $sc->get('._. \\o/'), '->set() sets a service');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetWithNullResetTheService()
|
public function testSetWithNullResetTheService()
|
||||||
|
@ -83,7 +83,7 @@ class RedirectResponse extends Response
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta http-equiv="refresh" content="1;url=%1$s" />
|
<meta http-equiv="refresh" content="0;url=%1$s" />
|
||||||
|
|
||||||
<title>Redirecting to %1$s</title>
|
<title>Redirecting to %1$s</title>
|
||||||
</head>
|
</head>
|
||||||
|
@ -90,6 +90,29 @@ abstract class UserPasswordValidatorTest extends AbstractConstraintValidatorTest
|
|||||||
->assertRaised();
|
->assertRaised();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider emptyPasswordData
|
||||||
|
*/
|
||||||
|
public function testEmptyPasswordsAreNotValid($password)
|
||||||
|
{
|
||||||
|
$constraint = new UserPassword(array(
|
||||||
|
'message' => 'myMessage',
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->validator->validate($password, $constraint);
|
||||||
|
|
||||||
|
$this->buildViolation('myMessage')
|
||||||
|
->assertRaised();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function emptyPasswordData()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
array(null),
|
||||||
|
array(''),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
|
* @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
|
||||||
*/
|
*/
|
||||||
|
@ -48,7 +48,7 @@ interface UserProviderInterface
|
|||||||
public function loadUserByUsername($username);
|
public function loadUserByUsername($username);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refreshes the user for the account interface.
|
* Refreshes the user.
|
||||||
*
|
*
|
||||||
* It is up to the implementation to decide if the user data should be
|
* It is up to the implementation to decide if the user data should be
|
||||||
* totally reloaded (e.g. from the database), or if the UserInterface
|
* totally reloaded (e.g. from the database), or if the UserInterface
|
||||||
@ -59,7 +59,7 @@ interface UserProviderInterface
|
|||||||
*
|
*
|
||||||
* @return UserInterface
|
* @return UserInterface
|
||||||
*
|
*
|
||||||
* @throws UnsupportedUserException if the account is not supported
|
* @throws UnsupportedUserException if the user is not supported
|
||||||
*/
|
*/
|
||||||
public function refreshUser(UserInterface $user);
|
public function refreshUser(UserInterface $user);
|
||||||
|
|
||||||
|
@ -40,6 +40,8 @@ class UserPasswordValidator extends ConstraintValidator
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (null === $password || '' === $password) {
|
if (null === $password || '' === $password) {
|
||||||
|
$this->context->addViolation($constraint->message);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user