-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
44 additions
and
108 deletions.
There are no files selected for viewing
File renamed without changes.
This file was deleted.
Oops, something went wrong.
50 changes: 0 additions & 50 deletions
50
src/DependencyInjection/SymfonyCastsResetPasswordExtension.php
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,22 +9,57 @@ | |
|
||
namespace SymfonyCasts\Bundle\ResetPassword; | ||
|
||
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; | ||
use Symfony\Component\HttpKernel\Bundle\Bundle; | ||
use SymfonyCasts\Bundle\ResetPassword\DependencyInjection\SymfonyCastsResetPasswordExtension; | ||
use Symfony\Component\Config\Definition\Configurator\DefinitionConfigurator; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; | ||
use Symfony\Component\DependencyInjection\Reference; | ||
use Symfony\Component\HttpKernel\Bundle\AbstractBundle; | ||
|
||
/** | ||
* @author Jesse Rushlow <[email protected]> | ||
* @author Ryan Weaver <[email protected]> | ||
*/ | ||
class SymfonyCastsResetPasswordBundle extends Bundle | ||
class SymfonyCastsResetPasswordBundle extends AbstractBundle | ||
{ | ||
public function getContainerExtension(): ?ExtensionInterface | ||
protected string $extensionAlias = 'symfonycasts_reset_password'; | ||
|
||
public function configure(DefinitionConfigurator $definition): void | ||
{ | ||
$definition->rootNode() /** @phpstan-ignore method.notFound */ | ||
->children() | ||
->scalarNode('request_password_repository') | ||
->isRequired() | ||
->info('A class that implements ResetPasswordRequestRepositoryInterface - usually your ResetPasswordRequestRepository.') | ||
->end() | ||
->integerNode('lifetime') | ||
->defaultValue(3600) | ||
->info('The length of time in seconds that a password reset request is valid for after it is created.') | ||
->end() | ||
->integerNode('throttle_limit') | ||
->defaultValue(3600) | ||
->info('Another password reset cannot be made faster than this throttle time in seconds.') | ||
->end() | ||
->booleanNode('enable_garbage_collection') | ||
->defaultValue(true) | ||
->info('Enable/Disable automatic garbage collection.') | ||
->end() | ||
->end() | ||
; | ||
} | ||
|
||
/** @param array<string, string|int|bool> $config */ | ||
public function loadExtension(array $config, ContainerConfigurator $container, ContainerBuilder $builder): void | ||
{ | ||
if (null === $this->extension) { | ||
$this->extension = new SymfonyCastsResetPasswordExtension(); | ||
} | ||
$container->import('../config/reset_password_services.xml'); | ||
|
||
return $this->extension ?: null; | ||
$container->services() | ||
->get('symfonycasts.reset_password.helper') | ||
->arg(2, new Reference((string) $config['request_password_repository'])) | ||
->arg(3, $config['lifetime']) | ||
->arg(4, $config['throttle_limit']) | ||
->get('symfonycasts.reset_password.cleaner') | ||
->arg(0, new Reference((string) $config['request_password_repository'])) | ||
->arg(1, $config['enable_garbage_collection']) | ||
; | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.