8000 throw exceptions if reset|verify are incompatible · symfony/maker-bundle@d9b7a29 · GitHub
[go: up one dir, main page]

Skip to content 8000

Commit d9b7a29

Browse files
committed
throw exceptions if reset|verify are incompatible
1 parent f69fc99 commit d9b7a29

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/Maker/MakeRegistrationForm.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
use Symfony\Component\Mailer\MailerInterface;
3939
use Symfony\Component\Routing\RouterInterface;
4040
use Symfony\Component\Validator\Validation;
41+
use SymfonyCasts\Bundle\VerifyEmail\Model\VerifyEmailSignatureComponents;
4142
use SymfonyCasts\Bundle\VerifyEmail\SymfonyCastsVerifyEmailBundle;
4243

4344
/**
@@ -368,7 +369,15 @@ private function getMissingComponentsComposerMessage(): ?string
368369
$missing = false;
369370
$composerMessage = 'composer require';
370371

371-
if (!class_exists(SymfonyCastsVerifyEmailBundle::class)) {
372+
// verify-email-bundle 1.2 includes support for translations and a fix for the bad expiration time bug.
373+
// we need to check that if the bundle is installed, it is version 1.2 or greater
374+
if (class_exists(SymfonyCastsVerifyEmailBundle::class)) {
375+
$reflectedComponents = new \ReflectionClass(VerifyEmailSignatureComponents::class);
376+
377+
if (!$reflectedComponents->hasMethod('getExpirationMessageKey')) {
378+
throw new RuntimeCommandException('Please upgrade symfonycasts/verify-email-bundle to version 1.2.0 or greater.');
379+
}
380+
} else {
372381
$missing = true;
373382
$composerMessage = sprintf('%s symfonycasts/verify-email-bundle', $composerMessage);
374383
}

src/Maker/MakeResetPassword.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
use Symfony\Component\Yaml\Yaml;
3636
use SymfonyCasts\Bundle\ResetPassword\Model\ResetPasswordRequestInterface;
3737
use SymfonyCasts\Bundle\ResetPassword\Model\ResetPasswordRequestTrait;
38+
use SymfonyCasts\Bundle\ResetPassword\Model\ResetPasswordToken;
3839
use SymfonyCasts\Bundle\ResetPassword\Persistence\Repository\ResetPasswordRequestRepositoryTrait;
3940
use SymfonyCasts\Bundle\ResetPassword\Persistence\ResetPasswordRequestRepositoryInterface;
4041
use SymfonyCasts\Bundle\ResetPassword\SymfonyCastsResetPasswordBundle;
@@ -82,6 +83,14 @@ public function configureDependencies(DependencyBuilder $dependencies)
8283
ORMDependencyBuilder::buildDependencies($dependencies);
8384

8485
$dependencies->addClassDependency(Annotation::class, 'annotations');
86+
87+
// reset-password-bundle 1.3 includes support for translations and a fix for the bad expiration time bug.
88+
// we need to check that version 1.3 is installed
89+
$reflectedToken = new \ReflectionClass(ResetPasswordToken::class);
90+
91+
if (!$reflectedToken->hasMethod('getExpirationMessageKey')) {
92+
throw new RuntimeCommandException('Please upgrade symfonycasts/reset-password-bundle to version 1.3.0 or greater.');
93+
}
8594
}
8695

8796
public function interact(InputInterface $input, ConsoleStyle $io, Command $command)

0 commit comments

Comments
 (0)
0