[Seaside] using WALoginDialog
Brian Brown
rbb at techgame.net
Fri Apr 1 19:32:24 CEST 2005
This doesn't use WALoginDialog, cuz I've never used that, but I hope it
helps ;)
First,
http://www.techgame.net/projects/Seaside/wiki/LoginComponentForGOODS
Read through this, and is should help. Since all the GOODS database
stuff in encapsulated in the Session, the login code part of this will
work with anything, GOODS not required.
Like HweeBoon said, make your application main class a Subclass of
WATask, and in the #go method do something like:
go
(self session loggedUser isNil)
ifTrue:
[self session loggedUser:
(self call: MyLoginComponent new)].
self call: (MyMainComponent new)
This is somewhat simplistic, but will work fine. What is happening?
the #go method basically acts like loop. Anywhere a #call: happens
effectively suspends the loop until the #call:'d component returns. In
the above code, the session method #loggedUser is checked, if it is
nil, then a new MyLoginComponent is instantiated and given control.
This method assumes that the MyLoginComponent returns the valid user
object. If a valid user/password aren't provided in the form, then the
MyLoginComponent never returns.
Once a valid login exists, control is turned over to MyMainComponent.
When the session times out, or you give an explicit logout method, the
#loggedUser will return nil again.
Brian
On Apr 1, 2005, at 7:25 AM, Tibor Blenessy wrote:
> Hi all
>
> I'm trying to build application with secure area, where I need login
> dialog. I have something like this
>
> SISMain>>renderContentOn:
>
> renderContentOn: html
>
> username := self call: (WALoginDialog new authenticator: (SISLogin
> new)).
> (username isNil)
> ifTrue: [html text: 'Must log in']
> ifFalse: [html text: 'Welcome!'].
>
> SISLogin is temporary now
>
> SISLogin>>verifyPassword: forUser
>
> verifyPassword: aPassword forUser: anUser
> ^anUser = 'tibor'
>
> Problem is, that if user succesfully logged in and then press back
> button
> he again see login form. And if he try to logg in again, he gets
> "500 Internal Server Error MessageNotUnderstood:
> UndefinedObject>>reset"
> Desired behavor is, that he can again succesfully login.
>
> Can anyone help?
>
> Tibor
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/listinfo/seaside
More information about the Seaside
mailing list