Add "Remember Me?" checkbox for extended sessions?

126 views
Skip to first unread message

Kenneth McDonald

unread,
Aug 29, 2011, 4:10:34 PM8/29/11
to lif...@googlegroups.com
Following the instructions on Assembla, I've successfully added Extended Session (remember me on this computer) functionality to my project. However, the instructions I was following didn't give any way of adding a "Remember me on this computer" checkbox to the login screen. Before I go in and try to add this myself, I was wondering if code had already been written to do this.

Thanks,
Ken

Richard Dallaway

unread,
Aug 31, 2011, 2:29:30 AM8/31/11
to lif...@googlegroups.com, lif...@googlegroups.com
It'd be great if you could share what you find: I'll need to do this before May 2012 for UK legislation changes regarding how cookies are used. 

Or: I'm happy to help out if you need any assistance. 

Richard

--
Sent from my phone, so may be terse. 
--
You received this message because you are subscribed to the Google Groups "Lift" group.
To view this discussion on the web visit https://groups.google.com/d/msg/liftweb/-/4OaBvzIvqboJ.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.

Viktor Hedefalk

unread,
Aug 31, 2011, 8:29:11 AM8/31/11
to lif...@googlegroups.com
The instructions for Extended Session on Assembla was GREAT! It was
such an easy thing to add. Thanks!

Regarding your question;

I don't think there is such a thing ready-made, but it would be rather
simple to do. Instead of just doing:

onLogIn = List(MyExtendedSession.userDidLogin _)
onLogOut = List(MyExtendedSession.userDidLogout _)

in your User Meta, you would probably want to add the checkbox to your
login-form and then only call MyExtendedSession.userDidLogin if it was
checked.

You could of course trait-ify this with a self-type of ProtoUser that:

* adds a boolean field on the model (doesn't need to be mapped, right?)
* overrides def loginXhtml to include the checkbox and save it to the model
* puts a hook in onLogIn: List[TheUserType => Unit] to call
MyExtendedSession.userDidLogin _ if the field was set

but it feels rather crappy to add an extra field on the user model
just for this since it shouldn't really be part of the model, but
should have a life time just tied to the login-form. I don't see any
other simple way though since the hooks are defined on the model.

Hm, I think I would just make my a custom login-page instead.

Cheers,
/v

David Pollak

unread,
Aug 31, 2011, 11:27:54 AM8/31/11
to lif...@googlegroups.com
Could you open a ticket on this feature referencing this thread.  I'll see what I can do to get it into Lift so it'll be easier to comply with UK laws.
--
Lift, the simply functional web framework http://liftweb.net

Richard Dallaway

unread,
Sep 1, 2011, 1:36:39 PM9/1/11
to lif...@googlegroups.com
Thanks David: http://www.assembla.com/spaces/liftweb/tickets/1103

I'd assumed it'd be a bit of hacking on the web app itself, but if there's something you can do in Lift to make it easy, that'd be wonderful. Thank you.

Ken - you might want to check that ticket to make sure we're both taking about the same thing.

Richard

Kenneth McDonald

unread,
Sep 1, 2011, 6:59:34 PM9/1/11
to lif...@googlegroups.com
Yes, that's exactly what I was talking about. Thanks, David, for looking into adding this.

Ken
Reply all
Reply to author
Forward
0 new messages