As we create the class, notice the two instance variable; login and password. These are used to store the data entered on the form generated by the renderContentOn: below. Something to note about this class - there are no references to GOODS anywhere.

WAComponent subclass: #TGWLogin
	instanceVariableNames: 'login password'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Techgame-Base-Seaside'

The renderContentOn: makes use of textInputWithValue:callback: to store the values in the inst vars for this class.

renderContentOn: html
	html form: [
		html defaultAction: [self confirmLogin].
		html heading: 'Welcome to my world' level: 3.
		html bold: 'Enter login name:'.
		html textInputWithValue: '' callback: [:v | login _ v].
		html br; br.
		html space; space; space; bold: 'Enter password:'.
		html passwordInputWithCallback: [:c | password _ c].
		html paragraph.
		html attributes: {'value'->'Login!'}.
		html submitButton.
	].

confirmLogin does the work; GOODS is reference through the session, so we don't know anything about it here.

confirmLogin
	(self session userForLogin: login)
	ifNotNilDo:  [:tryUser| (password = tryUser password) ifTrue: [self answer: tryUser]].
	self inform: 'Sorry, the password or login is incorrect.'

Next: Wrapping Up
Back: Setup Session
Top: Using GOODS with Seaside