repoze.who / Persistent Session max_age

36 views
Skip to first unread message

pk1024

unread,
Mar 1, 2010, 4:03:36 PM3/1/10
to TurboGears
I have been going through the group and it looks like the issue with
not being able to have a session perist beyond the browser being
closed was addressed in a patch. However I am not sure how to apply
said patch. Not only that I think its for an earlier version. I
currently have of repoze.who-1.0.15.

Thanks for any assitance anyone can provide. Looking at the change log
It looks ilke the newest 1.0 version has the fix (i think) but I can't
figure out how to get easy_install to install a specific version only
the most recent a 2.X which breaks everything.

I tried the repoze website thinking the download section would have it
but again I can't find specific versions only docs for specific
versions.

TIA,
Paul Kraus

Seth

unread,
Mar 2, 2010, 12:19:05 PM3/2/10
to TurboGears
Paul,

I also ran into the utter lack of a good implementation option for
this feature and have a bug opened here: http://trac.turbogears.org/ticket/2421

I'm assuming you're looking for some sort of "remember me" option on a
login form? As it stands now (even with the latest r.* updates), TG
doesn't appear to have an "easy way" to make this happen. I have been
able to monkey-patch repoze/who/plugins/auth_tkt.py to successfully
achieve this, but it is terribly ugly.

Seth

Paul Kraus

unread,
Mar 2, 2010, 12:22:54 PM3/2/10
to turbogears
The exact same issue. Any chance I can see your hack?

--
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To post to this group, send email to turbo...@googlegroups.com.
To unsubscribe from this group, send email to turbogears+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/turbogears?hl=en.




--
Paul Kraus
IT Director / Project Management Director
(440) 941-2321 Direct Dial
(216) 267.6176 Fax
www.pelsupply.com

Gustavo Narea

unread,
Mar 9, 2010, 5:02:56 PM3/9/10
to TurboGears
Hi.

You can implement "remember me" functionality both unconditionally and
conditionally (e.g., when the user wants to). The unconditional way is
supported out-of-the-box in newer versions of repoze.what-quickstart.

The conditional one is a bit more complex. Here's my response to an
email I received requesting this:
====
repoze.who-friendlyform is not in charge of remembering the user. This
is why it uses a proper "rememberer" internally -- friendlyform
doesn't
read/set cookies.

The place where this should be implemented is in the rememberer used
by
friendlyform. So, you can either propose a patch for auth_tkt in
repoze.who or extend friendly form like this:
http://pastebin.com/f7a0abe24

But I'd recommend the first option (fixing it in auth_tkt).
====

HTH,

- Gustavo.

Gustavo Narea

unread,
Mar 9, 2010, 5:07:39 PM3/9/10
to TurboGears
On Mar 9, 10:02 pm, Gustavo Narea <m...@gustavonarea.net> wrote:
> http://pastebin.com/f7a0abe24

Whoops, that had a typo. Here's an amended version:
http://pastebin.com/jnAsaEt1

Alessandro Molina

unread,
Mar 10, 2010, 5:31:45 AM3/10/10
to turbo...@googlegroups.com
On Tuesday 09 March 2010 23:02:56 Gustavo Narea wrote:
> Hi.
>
> You can implement "remember me" functionality both unconditionally and
> conditionally (e.g., when the user wants to). The unconditional way is
> supported out-of-the-box in newer versions of repoze.what-quickstart.

We have found a way to implement remember me in current version of Tg2.0 with
the version of repoze.what installed by Tg2.0 with a quick hack.

We set a cookie from the /login.html view to pass the remember_me option to
the controller and inside the /post_login we update the max_age.

You can find the code here: http://blog.axant.it/archives/231
It is not a complete solution, but it is a quick way to obtain the result.

Alessandro

Paul Kraus

unread,
Mar 10, 2010, 10:11:42 AM3/10/10
to turbo...@googlegroups.com
PERFECT, thanks, i was really over thinking this.

Paul

--
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To post to this group, send email to turbo...@googlegroups.com.
To unsubscribe from this group, send email to turbogears+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/turbogears?hl=en.

pkraus

unread,
Mar 13, 2012, 1:35:56 PM3/13/12
to turbo...@googlegroups.com
Sorry for the thread necromancy but this solution has stopped working since I upgraded to the 2.14. What are the steps, procedures, or links to said info on getting this same remember me functionality under the new version?

Alessandro Molina

unread,
Mar 13, 2012, 1:54:26 PM3/13/12
to turbo...@googlegroups.com
Recent TG versions should support remember me out of the box, that a
look at a newly quickstarted application login.html template.
It should come with a remember me button which should work.

> --
> You received this message because you are subscribed to the Google Groups
> "TurboGears" group.

> To view this discussion on the web visit
> https://groups.google.com/d/msg/turbogears/-/N2Xf081Taf0J.

Tobias Bieniek

unread,
Sep 17, 2012, 6:55:56 PM9/17/12
to turbo...@googlegroups.com
since I've been searching for the answer for quite some time now I will copy it here too for others with the same problem. the solution is simply adding the following line to the form that it used to login the user:

<input type="checkbox" name="remember" value="2252000" />

2252000 in this case is the number of seconds that the cookie should live. if the user checks the checkbox the cookie will have an expiration date, if the user doesn't then it will remain as before and be gone after the browser is closed.
Reply all
Reply to author
Forward
0 new messages