-
-
Notifications
You must be signed in to change notification settings - Fork 485
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
10 changed files
with
155 additions
and
63 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
{ | ||
"name": "Thomas Rabaix", | ||
"email": "[email protected]", | ||
"homepage": "http://sonata-project.org" | ||
"homepage": "https://sonata-project.org" | ||
}, | ||
{ | ||
"name": "Sonata Community", | ||
|
@@ -35,8 +35,6 @@ | |
"symfony/framework-bundle": "^5.4 || ^6.2", | ||
"symfony/http-foundation": "^5.4 || ^6.2", | ||
"symfony/http-kernel": "^5.4 || ^6.2", | ||
"symfony/mailer": "^5.4 || ^6.2", | ||
"symfony/mime": "^5.4 || ^6.2", | ||
"symfony/options-resolver": "^5.4 || ^6.2", | ||
"symfony/routing": "^5.4 || ^6.2", | ||
"symfony/security-acl": "^3.0", | ||
|
@@ -72,6 +70,8 @@ | |
"symfony/console": "^5.4 || ^6.2", | ||
"symfony/filesystem": "^5.4 || ^6.2", | ||
"symfony/intl": "^5.4 || ^6.2", | ||
"symfony/mailer": "^5.4 || ^6.2", | ||
"symfony/mime": "^5.4 || ^6.2", | ||
"symfony/phpunit-bridge": "^6.2", | ||
"vimeo/psalm": "^5.0" | ||
}, | ||
|
@@ -82,7 +82,9 @@ | |
}, | ||
"suggest": { | ||
"sonata-project/admin-bundle": "For admin dashboard to manage users and other entities", | ||
"sonata-project/doctrine-orm-admin-bundle": "For persisting entities" | ||
"sonata-project/doctrine-orm-admin-bundle": "For persisting entities", | ||
"symfony/mailer": "For sending reset emails", | ||
"symfony/mime": "For sending reset emails" | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true, | ||
|
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Sonata Project package. | ||
* | ||
* (c) Thomas Rabaix <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
use Sonata\UserBundle\Action\CheckEmailAction; | ||
use Sonata\UserBundle\Action\RequestAction; | ||
use Sonata\UserBundle\Action\ResetAction; | ||
|
||
return static function (ContainerConfigurator $containerConfigurator): void { | ||
// Use "param" function for creating references to parameters when dropping support for Symfony 5.1 | ||
$containerConfigurator->services() | ||
->set('sonata.user.action.request', RequestAction::class) | ||
->public() | ||
->args([ | ||
service('twig'), | ||
service('router'), | ||
service('security.authorization_checker'), | ||
service('sonata.admin.pool'), | ||
service('sonata.admin.global_template_registry'), | ||
service('form.factory'), | ||
service('sonata.user.manager.user'), | ||
service('sonata.user.mailer'), | ||
service('sonata.user.util.token_generator'), | ||
abstract_arg('retry ttl'), | ||
]) | ||
|
||
->set('sonata.user.action.check_email', CheckEmailAction::class) | ||
->public() | ||
->args([ | ||
service('twig'), | ||
service('router'), | ||
service('sonata.admin.pool'), | ||
service('sonata.admin.global_template_registry'), | ||
abstract_arg('token ttl'), | ||
]) | ||
|
||
->set('sonata.user.action.reset', ResetAction::class) | ||
->public() | ||
->args([ | ||
service('twig'), | ||
service('router'), | ||
service('security.authorization_checker'), | ||
service('sonata.admin.pool'), | ||
service('sonata.admin.global_template_registry'), | ||
service('form.factory'), | ||
service('sonata.user.manager.user'), | ||
service('translator'), | ||
abstract_arg('token ttl'), | ||
]); | ||
}; |
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
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
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
53 changes: 53 additions & 0 deletions
53
tests/DependencyInjection/SonataUserExtensionNoResettingTest.php
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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Sonata Project package. | ||
* | ||
* (c) Thomas Rabaix <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Sonata\UserBundle\Tests\DependencyInjection; | ||
|
||
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase; | ||
use Sonata\UserBundle\DependencyInjection\SonataUserExtension; | ||
|
||
/** | ||
* @author Anton Dyshkant <[email protected]> | ||
*/ | ||
final class SonataUserExtensionNoResettingTest extends AbstractExtensionTestCase | ||
{ | ||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->setParameter('kernel.bundles', [ | ||
'SonataDoctrineBundle' => true, | ||
'SonataAdminBundle' => true, | ||
]); | ||
} | ||
|
||
public function testMailerConfigParameterIfNotSet(): void | ||
{ | ||
$this->load(); | ||
|
||
$this->assertContainerBuilderNotHasService('sonata.user.mailer'); | ||
} | ||
|
||
public function testMailerConfigParameter(): void | ||
{ | ||
$this->load(['mailer' => 'custom.mailer.service.id']); | ||
$this->assertContainerBuilderNotHasService('sonata.user.mailer'); | ||
} | ||
|
||
protected function getContainerExtensions(): array | ||
{ | ||
return [ | ||
new SonataUserExtension(), | ||
]; | ||
} | ||
} |