You are here

public function TfaRouteSubscriber::alterRoutes in Two-factor Authentication (TFA) 8

Overrides user.login route with our custom login form.

Parameters

\Symfony\Component\Routing\RouteCollection $collection: Route to be altered.

Overrides RouteSubscriberBase::alterRoutes

File

src/Routing/TfaRouteSubscriber.php, line 23

Class

TfaRouteSubscriber
Listens to the dynamic route events.

Namespace

Drupal\tfa\Routing

Code

public function alterRoutes(RouteCollection $collection) {

  // Change path of user login to our overridden TFA login form.
  if ($route = $collection
    ->get('user.login')) {
    $route
      ->setDefault('_form', '\\Drupal\\tfa\\Form\\TfaLoginForm');
  }
}