Custom login page with Dancer2::Plugin::Auth::Extensible
Per the documentation, http://search.cpan.org/~hornburg/Dancer2-Plugin-Auth-Extensible-0.703/lib/Da... in my .yml config, I have: plugins: Auth::Extensible: # Set the view name for a custom login page, defaults to 'login' login_template: login but my login page: get '/login' => sub { ... template 'login', { ... }; }; doesn't seem to get called. I've tried "login_template: /login" but the default login is still getting loaded. Any ideas? thanks! Nathan
On 05/01/2017 09:42 AM, Nathan Bailey wrote:
Per the documentation, http://search.cpan.org/~hornburg/Dancer2-Plugin-Auth-Extensible-0.703/lib/Da... in my .yml config, I have: plugins: Auth::Extensible: # Set the view name for a custom login page, defaults to 'login' login_template: login
but my login page: get '/login' => sub { ...
template 'login', { ... }; };
doesn't seem to get called.
I've tried "login_template: /login" but the default login is still getting loaded.
Any ideas?
thanks! Nathan
Hello Nathan, I think you are mixing the concepts of the login template and the login route. This is covered here: http://search.cpan.org/~hornburg/Dancer2-Plugin-Auth-Extensible-0.703/lib/Da... If you just want a custom login template, don't use an extra route for login. Regards Racke -- Ecommerce and Linux consulting + Perl and web application programming. Debian and Sympa administration.
Thanks Stefan - you're right. It's "no_default_pages: 1" I needed, and it's now working - thanks :-) -N On 2 May 2017 at 16:50, Stefan Hornburg (Racke) <racke@linuxia.de> wrote:
On 05/01/2017 09:42 AM, Nathan Bailey wrote:
Per the documentation, http://search.cpan.org/~hornburg/Dancer2-Plugin-Auth- Extensible-0.703/lib/Dancer2/Plugin/Auth/Extensible.pm# SAMPLE_CONFIGURATION in my .yml config, I have: plugins: Auth::Extensible: # Set the view name for a custom login page, defaults to 'login' login_template: login
but my login page: get '/login' => sub { ...
template 'login', { ... }; };
doesn't seem to get called.
I've tried "login_template: /login" but the default login is still getting loaded.
Any ideas?
thanks! Nathan
Hello Nathan,
I think you are mixing the concepts of the login template and the login route.
This is covered here:
http://search.cpan.org/~hornburg/Dancer2-Plugin-Auth- Extensible-0.703/lib/Dancer2/Plugin/Auth/Extensible.pm# CUSTOMISING_/login_AND_/login/denied
If you just want a custom login template, don't use an extra route for login.
Regards Racke
-- Ecommerce and Linux consulting + Perl and web application programming. Debian and Sympa administration. _______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
Okay, so what I want to do is: i) Use DPAE's default logic (ie. the route) ii) Use *my* login template (ie. login.tt) I believe the correct argument for this is: login_template: login However, DPAE says: my $path = $template_engine->view_pathname($view); if ( !-f $path ) { but Dancer2::Template::TemplateToolkit says: sub view_pathname { my ( $self, $view ) = @_; return $self->_template_name($view); } ie. it returns the template *without* the path, so the -f fails, cf. Dancer2::Core::Role::Template, which includes the path in its view_pathname: sub view_pathname { my ( $self, $view ) = @_; $view = $self->_template_name($view); return path( $self->views, $view ); } I assume I am the first person to use the login_handler param in DPAE with TT? How are other people customising their login pages? -N On 2 May 2017 at 22:22, Nathan Bailey <web@polynate.net> wrote:
Thanks Stefan - you're right. It's "no_default_pages: 1" I needed, and it's now working - thanks :-) -N
On 2 May 2017 at 16:50, Stefan Hornburg (Racke) <racke@linuxia.de> wrote:
On 05/01/2017 09:42 AM, Nathan Bailey wrote:
Per the documentation, http://search.cpan.org/~hornbu rg/Dancer2-Plugin-Auth-Extensible-0.703/lib/Dancer2/Plugin/ Auth/Extensible.pm#SAMPLE_CONFIGURATION in my .yml config, I have: plugins: Auth::Extensible: # Set the view name for a custom login page, defaults to 'login' login_template: login
but my login page: get '/login' => sub { ...
template 'login', { ... }; };
doesn't seem to get called.
I've tried "login_template: /login" but the default login is still getting loaded.
Any ideas?
thanks! Nathan
Hello Nathan,
I think you are mixing the concepts of the login template and the login route.
This is covered here:
http://search.cpan.org/~hornburg/Dancer2-Plugin-Auth-Extensi ble-0.703/lib/Dancer2/Plugin/Auth/Extensible.pm#CUSTOMISING _/login_AND_/login/denied
If you just want a custom login template, don't use an extra route for login.
Regards Racke
-- Ecommerce and Linux consulting + Perl and web application programming. Debian and Sympa administration. _______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
Nevermind, I see this has been fixed in the latest version! -N (new code says if ( !$template_engine->pathname_exists($path) ) { ) On 15 May 2017 at 18:03, Nathan Bailey <web@polynate.net> wrote:
Okay, so what I want to do is: i) Use DPAE's default logic (ie. the route) ii) Use *my* login template (ie. login.tt)
I believe the correct argument for this is: login_template: login
However, DPAE says: my $path = $template_engine->view_pathname($view); if ( !-f $path ) {
but Dancer2::Template::TemplateToolkit says: sub view_pathname { my ( $self, $view ) = @_; return $self->_template_name($view); }
ie. it returns the template *without* the path, so the -f fails, cf. Dancer2::Core::Role::Template, which includes the path in its view_pathname: sub view_pathname { my ( $self, $view ) = @_;
$view = $self->_template_name($view); return path( $self->views, $view ); }
I assume I am the first person to use the login_handler param in DPAE with TT?
How are other people customising their login pages? -N
On 2 May 2017 at 22:22, Nathan Bailey <web@polynate.net> wrote:
Thanks Stefan - you're right. It's "no_default_pages: 1" I needed, and it's now working - thanks :-) -N
On 2 May 2017 at 16:50, Stefan Hornburg (Racke) <racke@linuxia.de> wrote:
On 05/01/2017 09:42 AM, Nathan Bailey wrote:
Per the documentation, http://search.cpan.org/~hornbu rg/Dancer2-Plugin-Auth-Extensible-0.703/lib/Dancer2/Plugin/A uth/Extensible.pm#SAMPLE_CONFIGURATION in my .yml config, I have: plugins: Auth::Extensible: # Set the view name for a custom login page, defaults to 'login' login_template: login
but my login page: get '/login' => sub { ...
template 'login', { ... }; };
doesn't seem to get called.
I've tried "login_template: /login" but the default login is still getting loaded.
Any ideas?
thanks! Nathan
Hello Nathan,
I think you are mixing the concepts of the login template and the login route.
This is covered here:
http://search.cpan.org/~hornburg/Dancer2-Plugin-Auth-Extensi ble-0.703/lib/Dancer2/Plugin/Auth/Extensible.pm#CUSTOMISING_ /login_AND_/login/denied
If you just want a custom login template, don't use an extra route for login.
Regards Racke
-- Ecommerce and Linux consulting + Perl and web application programming. Debian and Sympa administration. _______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
I set: no_login_handler: 1 So it doesn't use the default. Regardsm Chris. ---- On Tue, 02 May 2017 16:50:22 +1000 Stefan Hornburg (Racke) <racke@linuxia.de> wrote ----
On 05/01/2017 09:42 AM, Nathan Bailey wrote:
Per the documentation, http://search.cpan.org/~hornburg/Dancer2-Plugin-Auth-Extensible-0.703/lib/Da... in my .yml config, I have: plugins: Auth::Extensible: # Set the view name for a custom login page, defaults to 'login' login_template: login
but my login page: get '/login' => sub { ...
template 'login', { ... }; };
doesn't seem to get called.
I've tried "login_template: /login" but the default login is still getting loaded.
Any ideas?
thanks! Nathan
Hello Nathan,
I think you are mixing the concepts of the login template and the login route.
This is covered here:
http://search.cpan.org/~hornburg/Dancer2-Plugin-Auth-Extensible-0.703/lib/Da...
If you just want a custom login template, don't use an extra route for login.
Regards Racke
-- Ecommerce and Linux consulting + Perl and web application programming. Debian and Sympa administration. _______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
participants (3)
-
Chris Davies -
Nathan Bailey -
Stefan Hornburg (Racke)