15 april 2016
Drupal 8: display user login in admin theme
Do you want your websites users to log in? For certain types you would, but often there is no need. The Ibuildings website does not allow you to register an account and log in. Why would it?
However by default Drupal 8 (and earlier) considers logging in on /user part of the frontend theme. This means that either you have to theme it or accept a horribly broken login page.
Or you could convince Drupal to apply the admin theme to user pages.
In Drupal 7 you can use the example given on the Drupal.org page for hook_admin_paths_alter().
In Drupal 8 you’ll need to implement a custom RouteSubscriber. Here is what we have done for our new Drupal 8 site:
Next you need to register it as a service and tag it with “event_subscriber” *in* your services.yml:
Finally you’ll need to allow anonymous users to view the administration theme on “/admin/people/permissions”.
Hope this helps!