[web-devel] Potential gotcha in setSession/setCreds functions in Yesod

Michael Snoyman michael at snoyman.com
Wed Oct 20 22:16:48 CEST 2010


You're absolutely correct, I had intended to put that comment in. It
will be in the docs for 0.6.

Michael

On Wed, Oct 20, 2010 at 6:05 PM, Max Cantor <mxcantor at gmail.com> wrote:
> Maybe this is obvious to others, but it wasn't to me.  Any code that sets a cookie or session variable wont "take effect" until the next request.  Upon reflection, this should have been obvious to me because the session vars are read out of a Reader monad, but it wasnt..
>
> My point is that, you can't do something like:
>
> setCreds False creds
> m <- requireAuthId
>
> in a single request.  The simple solution is to stick a redirect in there.  Not suggesting any code changes, but a simple note in the haddocks :)
>
> Again, sry to bother if this should have been obvious too me.
>
> Max
>
> _______________________________________________
> web-devel mailing list
> web-devel at haskell.org
> http://www.haskell.org/mailman/listinfo/web-devel
>


More information about the web-devel mailing list