Skip to content

Commit

Permalink
Fix routing
Browse files Browse the repository at this point in the history
  • Loading branch information
core23 committed Aug 23, 2023
1 parent a21a12f commit 547d739
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ in your application:
anonymous: true
access_control:
- { path: ^/change-password, role: IS_AUTHENTICATED_REMEMBERED }
- { path: ^/update-security, role: IS_AUTHENTICATED_REMEMBERED }
# If you have an admin backend, uncomment the following line
# - { path: ^/admin/, role: ROLE_ADMIN }
Expand Down
12 changes: 11 additions & 1 deletion src/Resources/config/routing/update_security.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,20 @@
namespace Symfony\Component\Routing\Loader\Configurator;

use Nucleos\UserBundle\Action\UpdateSecurityAction;
use Symfony\Bundle\FrameworkBundle\Controller\RedirectController;

return static function (RoutingConfigurator $routes): void {
$routes->add('nucleos_user_update_security', '/change-password')
$routes->add('nucleos_user_update_security', '/update-security')
->controller(UpdateSecurityAction::class)
->methods(['GET', 'POST'])
;

$routes->add('nucleos_user_update_security_legacy', '/change-password')
->controller(RedirectController::class)
->methods(['GET', 'POST'])
->defaults([
'route' => 'nucleos_user_update_security',
'permanent' => true,
])
;
};
4 changes: 3 additions & 1 deletion tests/Routing/RoutingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ public function testLoadRouting(string $routeName, string $path, array $methods)
*/
public static function provideLoadRoutingCases(): iterable
{
yield ['nucleos_user_update_security', '/change-password', ['GET', 'POST']];
yield ['nucleos_user_update_security', '/update-security', ['GET', 'POST']];

yield ['nucleos_user_update_security_legacy', '/change-password', ['GET', 'POST']];

yield ['nucleos_user_resetting_request', '/resetting/request', ['GET', 'POST']];

Expand Down

0 comments on commit 547d739

Please sign in to comment.