You are here

public function RouteSubscriber::alterRoutes in No Request New Password 8

Alters existing routes for a specific collection.

Parameters

\Symfony\Component\Routing\RouteCollection $collection: The route collection for adding routes.

Overrides RouteSubscriberBase::alterRoutes

File

src/Routing/RouteSubscriber.php, line 17

Class

RouteSubscriber
Listens to the dynamic route events.

Namespace

Drupal\noreqnewpass\Routing

Code

public function alterRoutes(RouteCollection $collection) {

  // Always deny access to '/user/password', if noreqnewpass_disable is set to
  // TRUE.
  if ($route = $collection
    ->get('user.pass')) {
    $this
      ->denyAccess($route);
  }
  if ($route = $collection
    ->get('user.pass.http')) {
    $this
      ->denyAccess($route);
  }
}