Closed pavelsr closed 4 years ago
To display the login form, you want to use the (undocumented, this is a bug) login_form
helper:
%= $c->yancy->auth->login_form
All authentication modules install their helpers to the same place, so any auth module that has a login form will provide that helper. I'll improve the documentation in this area.
For the routes:
yancy.auth.password.login_form
is the route to send users to in order to display the login form (the yancy/auth/password/login_page.html.ep
template).yancy.auth.password.login
is the route which actually does the login procedure. If you're making your own form using the built-in Mojolicious form_for
helper, that's the destination you want.link_to( 'yancy.auth.password.logout' )
I think is working like that because there's no content. You want something like link_to "Logout", 'yancy.auth.password.logout'
or <%= link_to 'yancy.auth.password.logout', begin %>Logout<% end %>
I'm going to add examples of how to use the route names and mention which ones should be used for which things (form submission, link generation, etc...).
Thanks for asking these questions! It really helps me improve the docs and also to know how folks are using these things :)
In Yancy::Plugin::Auth::Password#ROUTES manual said:
What is the correct usage of Yancy::Plugin::Form::form_for with yancy.auth.password.login_form named route ?
If I call
output is empty
<form>...</form>
:There is no mention in Yancy::Plugin::Form::form_for how to use named route as argument, just
$schema
and%args
Also
link_to('yancy.auth.password.logout')
is working strange, output is<a href="/">yancy.auth.password.logout</a>
url_for
helper works fine withyancy.auth.password.login
named route as param.