Looks like redirect creates a new session

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Looks like redirect creates a new session

Brad Selfridge
I'm new to Seaside. I'm trying to create a "home" page that will contain menu bar etc.  But, I'm checking to see if the user has logged in first. If not, then I'm redirecting to a login page. I can walk through the login process, but when redirecting back to the "home" page the session does NOT have any login information in it. It looks to me like a redirect is creating a new session object rather than a shared session object. Does anyone know if this is true? Any ideas how I should tackle this?

I am using Seaside3(topa.278) configuration and Pharo 4.0.

Thanks,

Brad Selfridge
Brad Selfridge
Reply | Threaded
Open this post in threaded view
|

Re: Looks like redirect creates a new session

Johan Brichau-2
Brad,

Can you share the code how you redirect to the homepage?

The session id is stored in the url, and if you loose that when redirecting, a new session will be created.
This would happen when you are literally coding a redirect instead of using a WATask or a #call:/#answer flow.

Johan

> On 18 Nov 2015, at 16:46, [hidden email] wrote:
>
> I'm new to Seaside. I'm trying to create a "home" page that will contain menu
> bar etc.  But, I'm checking to see if the user has logged in first. If not,
> then I'm redirecting to a login page. I can walk through the login process,
> but when redirecting back to the "home" page the session does NOT have any
> login information in it. It looks to me like a redirect is creating a new
> session object rather than a shared session object. Does anyone know if this
> is true? Any ideas how I should tackle this?
>
> I am using Seaside3(topa.278) configuration and Pharo 4.0.
>
> Thanks,
>
> Brad Selfridge
>
>
>
> -----
> Brad Selfridge
> --
> View this message in context: http://forum.world.st/Looks-like-redirect-creates-a-new-session-tp4861716.html
> Sent from the Seaside General mailing list archive at Nabble.com.
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Looks like redirect creates a new session

Brad Selfridge
Ah.

That's probably the problem. I'm simply passing the string "\login" to the redirect. Looks like I need to inject "\login" into the current url.

I'll look into that.

Thanks,
Brad Selfridge
Reply | Threaded
Open this post in threaded view
|

Re: Looks like redirect creates a new session

Johan Brichau-2
Actually, for this flow, you should not be using redirect explicitly.

Take a look at Seaside Tasks and how to pass control-flow on from one component to another via call:answer:
That is the Seaside way of developing this and it’s explained in the Seaside book.

cheers
Johan

> On 18 Nov 2015, at 17:08, [hidden email] wrote:
>
> Ah.
>
> That's probably the problem. I'm simply passing the string "\login" to the
> redirect. Looks like I need to inject "\login" into the current url.
>
> I'll look into that.
>
> Thanks,
>
>
>
> -----
> Brad Selfridge
> --
> View this message in context: http://forum.world.st/Looks-like-redirect-creates-a-new-session-tp4861716p4861722.html
> Sent from the Seaside General mailing list archive at Nabble.com.
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Looks like redirect creates a new session

Brad Selfridge
I looked at task and thought that it would only get me part of the way.

Question: What happens if the user is sitting on a page for a long time and the session expires? My thought was that the application would show an expired page that had a button that forced the user back to the "home" page or redirect back to the login page. This is why I was traveling down the redirect path in the first place. (I'm not committed to my way by any means).
Brad Selfridge
Reply | Threaded
Open this post in threaded view
|

Re: Looks like redirect creates a new session

Stephan Eggermont-3
On 18-11-15 20:03, [hidden email] wrote:
> I looked at task and thought that it would only get me part of the way.
>
> Question: What happens if the user is sitting on a page for a long time and
> the session expires?

We try to avoid that. If you can afford to have long sessions:

QCComponent>>renderKeepAliveOn: canvas
        | cacheTimeout |
        cacheTimeout := self session application cache expiryPolicy
configuration at: #cacheTimeout.
        canvas document addLoadScript:
                (canvas jQuery ajax
                        callback: [];
                        interval: (cacheTimeout - 60) seconds)

And then in the application

QCApplication>>renderContentOn: canvas
        self hasKeepAlive
                ifTrue: [ self renderKeepAliveOn: canvas ].
        self renderHeaderOn: canvas.
        super renderContentOn: canvas

Stephan

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside