[Seaside] Session Problem

John M p3anoman at gmail.com
Fri Dec 5 18:43:12 UTC 2008

I put a subclass of WATask on the front end to solve all that: One instance
variable to holds an FBPLogin component (subclass of WAComponent)

FBPTask >> initialize
   dialog := FBPDialog new

FBPTask >> go
 | x |
 [ (x := self call: dialog) notNil ] whileFalse: [ ].   "dialog answers a
user object or nil"
 self session userisregistered                          "userisregistered is
a custom method of my WASession subclass"
  ifTrue: [
   dialog login: nil.
   self call: FBPPoolComponent new.          "call the main page"
   dialog login: FBPPlayer new.                  "the main page anwers when
the user explicitly logs out via a logout link; and we go back to GO
(collect $200)"

So it just keeps calling the login component until a successful login after
which it calls the main component and when that component "answers" it sets
the login component's to a new user and waits for another successful login.

If the user clicks anything after the session is expired, the server reverts
to the root which in turn calls go again and starts the whole process over.
WATask is handy for this sort of thing.

On Thu, Dec 4, 2008 at 11:57 AM, Sebastián Perez Escribano <
sebaspe at gmail.com> wrote:

> Hi list, I have a problem with the login session in my site. I'm using
> Seaside and Shore Components. The main component of the site has two divs, a
> menu to the left, and the main page to the right. On the menu I use anchors
> that on click show different components in the main page (via AJAX). The
> thing is that when the session expires, I need to go back to the login page.
> I've overridden the method #incomingRequest: to check if the session is
> active and redirect it to the login page if needed to. Here's the code to do
> that:

> MySession >> incomingRequest: aRequest
> ^self checkIsActive
>            ifTrue: [super incomingRequest: aRequest]
>            ifFalse:  [self logOut: aRequest]]
> MySession >> logOut: aRequest
>  | wttHome |
>  wttHome := self parent baseUrl asString.
> ^WAResponse redirectTo: wttHome
> This works with the components in the main page, for example:  in the main
> div I have a component with a button. If I click on the button and the
> session isn't active, the session redirects to the log in component,
> cleaning all the page. _But when I click on the anchors in the left div (the
> menu) and the session isn't active,  the log-in component  is placed on the
> right div (the main component) and does not refresh all the page (the menu
> still shows). So in this case I end up with a menu on the left with anchors
> and the log-in component in the rigth, and i don't want the menu component
> showing in this case.
> This is the method that is called when I click on an anchor in the left
> menu div.
> WAMyLeftMenu >> updaterOn: html for: component
> "This is the method with problems"
> ^(html updater)
>    id: 'mainComponent';
>    callback: [:renderer | self showMainComponent: component on: renderer]
> If the session  isn´t active, the callback is never called.
> Anyone has any experience dealing with expired (via time-out or by code)
> sessions and how to reacting to it (redirecting, logging out, etc)?
> Any help on this will be appreciated.
> Cheers, Sebastian.
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20081205/8bf4623c/attachment.htm

More information about the seaside mailing list