[Seaside] Problem with continuations/flow.

Tobias Pape Das.Linux at gmx.de
Tue May 24 08:21:00 UTC 2011


Am 2011-05-24 um 09:50 schrieb Julian Fitzell:

> #actionUrlForContinuation: doesn't expect a first-class continuation
> but rather a CPS continuation (a subclass of WASessionContinuation).
> Actually, to be more accurate, WASession>>handleFiltered: expects that
> to be so. Actually, to be more accurate, it expects something that
> responds to successfully to #value.
> 
> Technically, I think you could avoid the error by doing:
> 
> testCC
>     self inform: 'A'.
>     self wait: [ :cc |
>             self inform: 'B: ', ( self session
> actionUrlForContinuation: [ cc value: nil ]) greaseString.
>             self answer].
>     self inform: 'C'.
>     self answer.
> 
> However, I doubt you'll be happy with the results: part of the
> implementation of WASessionContinuation>>value is to restore
> backtracked state, and its subclasses do things like processing
> callbacks and starting rendering. Without the handling that deals with
> callbacks, for example, your call to #answer inside the block won't
> work.


In the original Squeaksource Code, this facility was used to
generate Password-reset links like this (in seaside 2.7*):

  1 sendPasswordToUserWithLogin: login
  2	| member url |
  3	member := self model memberAt: login.
  4
  5	" validation here "
  6	Continuation currentDo: [ :cc | 
  7		url := self session actionUrlForContinuation: cc.
  8		url := SSRepository rootUrl , url copyWithoutFirst.
  9		self sendMailWithUrl: url toMember: member. "exception handling here"
 10		self inform: 'An e-mail has been successfully sent to you.'.
 11		self answer ].
 12	self callEditMemberForm. "shortened for brevity"
 13	self answer.

with the effect, that on the website the ‘link to the continuation’ was
generated (7/8) and sent as email to se user (9). The user was informed
that the email had been sent (10) and was returned where he came from (11)
  Now when the user clicked on the link in the email, the continuation
continued from 12, effectively allowing the user to change her/his password.

I think this is one of the most elegant ways to implement a secure
password reset. Yet, this no longer works with Seaside 3.0, 
Neither using
	WAComponent>>#wait: ,
	GRPlatform>>#seasideSuspendFlowDo: ,
	WAContinuation>>#currentDo: , nor
	WAPartialContinuation>>#currentDo:
(I tried the last with various marker setups)

I hope you can enlighten me there.

Best
	-Tobias



* for reference, the same from SqueakSource2 with Seaside 2.8, but
  the differences are minor.

sendPasswordToUserWithLogin: login
	| member url |
	member := self model memberAt: login.
	" " validation here "
	WAContinuation currentDo: [ :cc | 
		url := self session actionUrlForContinuation: cc.
		url := self repository rootUrl , url copyWithoutFirst.
		self sendMailWithUrl: url toMember: member. "exception handling here"
		self inform: 'An e-mail has been successfully sent to you.'.
		self answer ].
	self editMember: 'Change your password'.
	self answer


More information about the seaside mailing list