[dancer-users] Custom login page with Dancer2::Plugin::Auth::Extensible

Nathan Bailey web at polynate.net
Mon May 15 10:12:36 BST 2017


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 at 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 at 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 at 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 at dancer.pm
>>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
>>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20170515/43824b9d/attachment.html>


More information about the dancer-users mailing list