[Seaside] How to do a "login required" type of filter

Pat Maddox pat.maddox at gmail.com
Thu May 28 01:21:20 UTC 2009


I need to get login credentials for some pages that might be deep
linked.  I have a LoginForm component that gets called, returning the
user if its found:

authenticate
	(AccountRepository find: domain verify: password) ifNotNil: [ self
answer: account. ].

authenticate is called when the login form is submitted.

So how do I get to render the login form?  Well I started off with a
LoginDecoration.  It looks like
renderContentOn: html
	self session account ifNotNil: [
		self renderOwnerOn: html.
	] ifNil: [ self session account: (self call: ANLoginForm new) ].

WADecorations don't have call: though.  So I tried doing the call
directly from my component requiring an authenticated user:

renderContentOn: html
	self requireLogin.
        "the stuff that I render after I have a logged in user"

requireLogin
	self session account ifNil: [self session account: (self call:
ANLoginForm new)].

When I tried this, I got the following error:
MessageNotUnderstood: UndefinedObject>>updateStates:
WARenderContinuation(WASessionContinuation)>>updateStates:
[] in WARenderContinuation(WASessionContinuation)>>respond: {[:value |
self updateStates: states]}
[] in ANSession(WASession)>>onRespond: {[:response | aBlock value:
response. previous value: response]}
ANSession(WASession)>>returnResponse:
ANSession(WASession)>>pageIntentionallyLeftBlank
[] in ANSession(WASession)>>withEscapeContinuation: {[:cc |
escapeContinuation := cc. aBlock value. self
pageIntentionallyLeft...]}
EscapeContinuation class(Continuation class)>>currentDo:
ANSession(WASession)>>withEscapeContinuation:
ANSession(WASession)>>responseForRequest:
[] in ANSession(WASession)>>incomingRequest: {[self
responseForRequest: aRequest]}
BlockContext>>on:do:
[] in WAProcessMonitor>>critical:ifError: {[value := aBlock on: Error
do: anErrorBlock]}
BlockContext>>ensure:
[] in WAProcessMonitor>>critical:ifError: {[[value := aBlock on: Error
do: anErrorBlock] ensure: [semaphore signal]]}
[] in BlockContext>>newProcess {[self value. Processor terminateActive]}

No clue what that means, couldn't find anything on google, and this
errors without all the nice seaside links so I'm not able to fire up
the debugger.

I read in http://www.shaffer-consulting.com/david/Seaside/CallAnswer/index.html
that you shouldn't use call from within renderContentOn.  I don't know
if that means that call *doesn't work* from within renderContentOn, or
it's just a style thing.

Anyway...all I want to do is, when I begin to render a page, check for
an account in the session and if it doesn't exist prompt a login.  I'm
sure this is simple and I'm just doing something stupid at this point.
 Can anyone help out?

Pat


More information about the seaside mailing list