1

I'd like to apply the admin (or other) theme to user /user/login page. Since ThemeKey isn't available I'm attempting to implement via routes. "View admin theme" permission is granted to anonymous.

Using this route:

my_module_name.user_login: path: '/user/login' options: _custom_theme: 'my_custom_theme'

gives the correct theme, but a 403 response on the /user/login page. Why am I getting a 403 response (with the anticipated theme) instead of the standard login page?

1 Answer 1

4

Because you don't have any access checks.

If anyone is allowed to access it, you must specify so explicitly with _access: 'true' in an access section.

3
  • Thanks. That's correct, though it begs the question: why DOES this work without specifying _access: my_module.dogtracks_export_time: path: '/my-custom-path' options: _custom_theme: 'my_theme' It's also worth noting that simply adding _access' to my use case changes the 403 to a 404. Adding _form: ...\UserLoginForm` is required to get it working correctly. Feb 15, 2016 at 22:23
  • I would think you have to do a route alter (drupal.org/node/2187643) instead of redeclaring an existing route. @Berdir, am I just wrong?
    – cilefen
    Feb 15, 2016 at 23:46
  • I didn't see that you use an existing path. Yes, you should in that case.
    – Berdir
    Feb 16, 2016 at 6:25

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.