Drupal 8 - I have the following issue:

The problem is that the password reset page uses the administrator theme, while I need it uses the default site theme.

1 Answer 1


You can use a RouteSubscriber to do that but it will also affect your user edit form and render it with the default site theme since it uses the same route name. The RouteSubscriber can't alter a route based on a query string parameter such as pass-reset-token


    class: Drupal\yourmodule\Routing\YourmoduleRouteSubscriber
      - { name: event_subscriber, priority: 1 }



namespace Drupal\yourmodule\Routing;

use Drupal\Core\Routing\RouteSubscriberBase;
use Symfony\Component\Routing\RouteCollection;

 * Custom route subscriber.
class YourmoduleRouteSubscriber extends RouteSubscriberBase {

   * {@inheritdoc}
  protected function alterRoutes(RouteCollection $collection) {
    if ($route = $collection->get('entity.user.edit_form')) {
      $options = $route->getOptions();
      $options['_custom_theme'] = 'yourthemename';

  • OR use the Switch page theme module.
    – No Sssweat
    Dec 4, 2020 at 1:23
  • 1
    If you use a custom theme negotiator you can respond to the query string
    – Clive
    Dec 4, 2020 at 20:46
  • Sounds good @Clive ! Your comment should be the answer in my opinion
    – MacSim
    Dec 4, 2020 at 22:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.