[squeak-dev] [Q] help with requesting a html page
Chris Cunnington
smalltalktelevision at gmail.com
Sun Nov 20 17:18:13 UTC 2011
HVNaughtieUsers? OK, so you're using HttpView2.
Your code example is too low level in an HVHttpView2 app. That stuff is abstracted away. You won't see
request propertyAt:
in here
http://map.squeak.org/srcautologin
http://map.squeak.org/srcnewaccount
HttpView2 talks to Komanche for you. I'd look at the HVSimpleForms>>#megaform2 example and look at stuff like this:
"Add a password."
pass _ b br; br; html: 'Password: '; inputPassword.
pass2 _ b br; html: 'Verify: '; inputPassword.
(pass value isEmpty and: [pass2 value isEmpty]) ifFalse: [
pass value = pass2 value
ifTrue: [message value: '<b>Verified correctly!</b>']
ifFalse: [message value: '<b>Verified incorrectly!</b>']].
"Add two breaks and a submit button, end the form."
button _ b br; br; submit: 'Hit me'.
b endForm.
And in SMSqueakMapView>>#login:url: (in SMServer at Göran's repo) which has:
b ifPost: [
(requestedUrl value = (self prefix, '/login')) ifTrue:[requestedUrl value: self prefix].
account _ model accountForUsername: username.
account ifNil: [account _ model accountForEmail: username].
account ifNil: [msg value: 'No account with that username or email!']
ifNotNil: [
account password isNil
ifTrue: [msg value: 'First login should be done using the link provided in the confirmation email!']
ifFalse: [
(account correctPassword: password)
ifTrue:[
KomSession current attributes at: #account put: account.
^self redirectTo: requestedUrl value ]
ifFalse:[
KomSession current attributes at: #failedAccount put: account.
msg value: 'Wrong password - ', (b getLinkLocal: '/mailnewpassword' text: 'would you like a new one?') ]]]
].
Of course, you could try using a body of code that wasn't developed in Squeak 3.8.
http://www.squeakmap.org
Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20111120/88357b83/attachment.htm
More information about the Squeak-dev
mailing list
|