Login custom login page

In Login plugin documentation, a custom login page is possible if in user/config/plugins/login.yaml
there is the line

route: /user-login

I added to user/config/plugins/login.yaml the line

route: /newLogin

to login.yaml.

I created a file newLogin.md based on login.md in login/pages with only a couple of extra words to differentiate between the new and default.
I have been unable to get Grav to recognise newLogin.md in any location.

I have a single page where in the front matter, access: site.login: true is set, namely for <mysite>/events
As soon as a user tries to access the page, login is invoked - good.
But only the default login page is triggered - bad

I have put newLogin.md in all of the following directories:

user/plugins/login/pages/
user/pages/
user/pages/events/
user/pages/en-gb/

My site uses multiple languages, in particular: en-gb, zh-cn, zh-hk
I have therefore put newLogin.en-gb.md in the following directories:

user/plugins/login/pages/
user/pages/
user/pages/events/

None of these work. In each case the default login page is triggered.
Is this my error (not putting newLogin in the right place) or a bug?

The best thing to do is:

  1. Create your reference to route: "/new-login"
  2. Create a new page file in user/pages/new-login/login.md. note the route is /new-login but the file is still called login.md, this is so that it will still use the login.html.twig that the plugin provides.

This should work even with multilanguage. If you want to have different versions of this login for different language, then you would just rename the file login.md to login.en-gb.md for example. That should work. If you continue to have problems, i’ll investigate your issue directly on the ticket you opened: https://github.com/getgrav/grav-plugin-login/issues/126

Thank you for this information.

Now I understand. However, it would be useful for this to be in the
documentation. Sometimes the documentation assumes complete knowledge of
the whole system, so questions like mine occur. More examples would help.

Thank you again.

I will try this and get back if I have trouble. But I think I understand
the paradigm now.

Richard

2 Likes