[dancer-users] Second cookie [ for 'remember me' username only ]

Nathan Bailey web at polynate.net
Mon Apr 24 11:23:03 BST 2017


Awesome! I have no idea how I missed that part of the manual.

I'm using:
   cookie 'remember_me_user' => undef, http_only => 1, expires => -1;
if they turn it off, which seems to delete it immediately.

thanks,
Nathan


On 24 April 2017 at 17:21, Andrew Beverley <andy at andybev.com> wrote:

> On Mon, 24 Apr 2017 10:25:35 +1000 Nathan Bailey wrote:
> > Hi all,
> >  I'd like to have a 'remember me' cookie for users who want their
> > username to be remembered by the browser (but not the password).
> >
> > Dancer2::Core::Role::SessionFactory's set_cookie_header seems quite
> > specific to sessions, so it appears that the right/best way to do it
> > is to use push_header (as set_cookie_header does), viz:
> > if (is_successful_login && defined params->{remember_me} &&
> > params->{remember_me}) {
> >     push_header(
> >         'Set-Cookie',
> >         (remember_me_user => session('user'))
> >    );
> > }
>
> You can just use the Dancer keyword "cookie":
>
>   cookie 'remember_me_user' => session('user'), http_only => 1;
>
>
> Regards,
>
> Andy
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20170424/f455104d/attachment.html>


More information about the dancer-users mailing list