[Seaside] Re: Sending a continuation link via email in Seaside-3.0

Yanni Chiu yanni at rogers.com
Mon Oct 18 19:06:10 UTC 2010


On 18/10/10 11:16 AM, Yanni Chiu wrote:
> On 18/10/10 7:56 AM, Julian Fitzell wrote:
>>
>> You could use partial continuations, but can't you just register a
>> callback and send that URL? You're not really doing anything that
>> seems to require a continuation...
>
> Okay, I'll try that. I was just going with the code that was there in
> the squeaksource3 repository, but I was beginning to suspect that the
> code there is not fully working yet.

Changing WAContinuation to WAPartialContinuation yield a stack trace.

Registering a callback and sending that URL - that worked like a charm. 
The new code is attached.
-------------- next part --------------
WAComponent subclass: #ZZRegistration
	instanceVariableNames: 'email'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'ZZTemp'!

!ZZRegistration methodsFor: 'accessing' stamp: 'YanniChiu 10/17/2010 23:05'!
email

	^ email! !

!ZZRegistration methodsFor: 'accessing' stamp: 'YanniChiu 10/17/2010 23:05'!
email: anObject

	email := anObject! !


!ZZRegistration methodsFor: 'actions' stamp: 'YanniChiu 10/17/2010 23:17'!
register
	self call: (ZZSendRegistrationLink new email: self email)! !


!ZZRegistration methodsFor: 'rendering' stamp: 'YanniChiu 10/17/2010 23:05'!
renderContentOn: html
	self renderFormOn: html! !

!ZZRegistration methodsFor: 'rendering' stamp: 'YanniChiu 10/17/2010 23:05'!
renderFormOn: html
	html form class: 'registration-form'; with: [
		html span: 'Email: '.
		html textInput
			value: self email;
			callback: [ :value | self email: value ].
		html break.
		html submitButton callback: [ self register ]; with: 'Register' ]! !

"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!

ZZRegistration class
	instanceVariableNames: ''!

!ZZRegistration class methodsFor: 'accessing' stamp: 'YanniChiu 10/17/2010 23:05'!
label
	^ 'Registration'! !


!ZZRegistration class methodsFor: 'initialize' stamp: 'YanniChiu 10/17/2010 23:06'!
initialize
	WAAdmin register: self asApplicationAt: 'register'! !


!ZZRegistration class methodsFor: 'testing' stamp: 'YanniChiu 10/17/2010 23:05'!
isAbstract
	^ false! !


WAComponent subclass: #ZZSendRegistrationLink
	instanceVariableNames: 'email url'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'ZZTemp'!

!ZZSendRegistrationLink methodsFor: 'accessing' stamp: 'YanniChiu 10/17/2010 23:07'!
email

	^ email! !

!ZZSendRegistrationLink methodsFor: 'accessing' stamp: 'YanniChiu 10/17/2010 23:07'!
email: anObject

	email := anObject! !

!ZZSendRegistrationLink methodsFor: 'accessing' stamp: 'YanniChiu 10/18/2010 14:33'!
url

	^ url! !

!ZZSendRegistrationLink methodsFor: 'accessing' stamp: 'YanniChiu 10/18/2010 14:33'!
url: anObject

	url := anObject! !


!ZZSendRegistrationLink methodsFor: 'actions' stamp: 'YanniChiu 10/17/2010 23:13'!
cancel
	self answer: nil.! !

!ZZSendRegistrationLink methodsFor: 'actions' stamp: 'YanniChiu 10/18/2010 14:08'!
continueRegistration
	self inform: 'Continuing registration process...'.
	self answer! !

!ZZSendRegistrationLink methodsFor: 'actions' stamp: 'YanniChiu 10/18/2010 14:36'!
send
	self inform: 'Use this url to continue registration process: ', 'http://localhost:8080', url greaseString.
	self answer! !


!ZZSendRegistrationLink methodsFor: 'rendering' stamp: 'YanniChiu 10/18/2010 14:45'!
renderContentOn: html
	html heading: 'I forgot my password'.
	html render: 'You will get an e-mail with a secure url that takes you to your personal member-settings where you are able to set a new password. The url will be available for a few minutes only, so check your e-mail soon.'.
	html break; break.
	url := html actionUrl copy.
	url addField: (html callbacks store: (WAActionCallback on: [ self continueRegistration ])).
	html form
		defaultAction: [ self send ];
		with: [
			html div: [
					html submitButton
						callback: [ self send ];
						text: 'Send'.
					html space.
					html submitButton
						callback: [ self cancel ];
						text: 'Cancel' ] ]! !

ZZRegistration initialize!


More information about the seaside mailing list