Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Maker/MakeForgottenPassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@
use Symfony\Bundle\MakerBundle\DependencyBuilder;
use Symfony\Bundle\MakerBundle\Doctrine\ORMDependencyBuilder;
use Symfony\Bundle\MakerBundle\Exception\RuntimeCommandException;
use Symfony\Bundle\MakerBundle\FileManager;
use Symfony\Bundle\MakerBundle\Generator;
use Symfony\Bundle\MakerBundle\InputConfiguration;
use Symfony\Bundle\MakerBundle\Renderer\FormTypeRenderer;
use Symfony\Bundle\MakerBundle\Security\InteractiveSecurityHelper;
use Symfony\Bundle\MakerBundle\Util\YamlSourceManipulator;
use Symfony\Bundle\SecurityBundle\SecurityBundle;
use Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle;
use Symfony\Bundle\TwigBundle\TwigBundle;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Bundle\MakerBundle\FileManager;
use Symfony\Bundle\MakerBundle\Renderer\FormTypeRenderer;
use Symfony\Component\Validator\Validation;
use Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle;

/**
* @author Romaric Drigon <romaric.drigon@gmail.com>
Expand Down
5 changes: 4 additions & 1 deletion src/Renderer/FormTypeRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,17 @@ public function render(ClassNameDetails $formClassDetails, array $formFields, Cl
$fields[$name] = $fieldTypeOptions;
}

$mergedTypeUseStatements = array_merge($fieldTypeUseStatements, $extraUseClasses);
sort($mergedTypeUseStatements);

$this->generator->generateClass(
$formClassDetails->getFullName(),
'form/Type.tpl.php',
[
'bounded_full_class_name' => $boundClassDetails ? $boundClassDetails->getFullName() : null,
'bounded_class_name' => $boundClassDetails ? $boundClassDetails->getShortName() : null,
'form_fields' => $fields,
'field_type_use_statements' => array_merge($fieldTypeUseStatements, $extraUseClasses),
'field_type_use_statements' => $mergedTypeUseStatements,
'constraint_use_statements' => $constraintClasses,
]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,15 @@ public function reset(Request $request, UserPasswordEncoderInterface $passwordEn
throw $this->createNotFoundException();
}

$passwordResetToken = $this->getDoctrine()->getRepository(PasswordResetToken::class)->findOneBy([
'selector' => substr($tokenAndSelector, 0, PasswordResetToken::SELECTOR_LENGTH),
$passwordResetToken = $this->getDoctrine()->getRepository(<?= $token_class_name ?>::class)->findOneBy([
'selector' => substr($tokenAndSelector, 0, <?= $token_class_name ?>::SELECTOR_LENGTH),
]);

if (!$passwordResetToken) {
throw $this->createNotFoundException();
}

if ($passwordResetToken->isExpired() || !$passwordResetToken->isTokenEquals(substr($tokenAndSelector, PasswordResetToken::SELECTOR_LENGTH))) {
if ($passwordResetToken->isExpired() || !$passwordResetToken->isTokenEquals(substr($tokenAndSelector, <?= $token_class_name ?>::SELECTOR_LENGTH))) {
$this->getDoctrine()->getManager()->remove($passwordResetToken);
$this->getDoctrine()->getManager()->flush();

Expand All @@ -125,7 +125,7 @@ public function reset(Request $request, UserPasswordEncoderInterface $passwordEn
$form->handleRequest($request);

if ($form->isSubmitted() && $form->isValid()) {
// A PasswordResetToken should be used only once, remove it.
// A <?= $token_class_name ?> should be used only once, remove it.
$this->getDoctrine()->getManager()->remove($passwordResetToken);

// Encode the plain password, and set it.
Expand Down
2 changes: 1 addition & 1 deletion src/Security/SecurityControllerBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function addLogoutMethod(ClassSourceManipulator $manipulator)
$manipulator->addUseStatementIfNecessary(Route::class);
$manipulator->addMethodBody($logoutMethodBuilder, <<<'CODE'
<?php
throw new \Exception('This method can be blank - it will be intercepted by the logout key on your firewall');
throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
CODE
);
$manipulator->addMethodBuilder($logoutMethodBuilder);
Expand Down
1 change: 1 addition & 0 deletions tests/Maker/MakeForgottenPasswordTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public function getTestDetails()
->setFixtureFilesPath(__DIR__.'/../fixtures/MakeForgottenPassword')
->configureDatabase()
->updateSchemaAfterCommand()
->addExtraDependencies('symfony/swiftmailer-bundle')
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ public function login(AuthenticationUtils $authenticationUtils): Response
*/
public function logout()
{
throw new \Exception('This method can be blank - it will be intercepted by the logout key on your firewall');
throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ class SecurityController extends AbstractController
*/
public function logout()
{
throw new \Exception('This method can be blank - it will be intercepted by the logout key on your firewall');
throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
}
}