WebApp: Require a very simple login...
This commit is contained in:
parent
1c8cce66ef
commit
0427513af8
28
WebApp.st
28
WebApp.st
|
@ -120,6 +120,13 @@ Iliad.ILWidget subclass: CallWidget [
|
|||
Iliad.ILSession subclass: GSMTestphoneSession [
|
||||
| user gsmConfig procedures |
|
||||
|
||||
isAuthenticated [
|
||||
^ user = 'toto-user'
|
||||
]
|
||||
|
||||
username: aUser [
|
||||
user := aUser.
|
||||
]
|
||||
|
||||
gsmConfig [ ^ gsmConfig ifNil: [gsmConfig := PhoneConfig new. ]]
|
||||
procedures [ ^ procedures ifNil: [procedures := OrderedCollection new]]
|
||||
|
@ -162,6 +169,27 @@ Iliad.ILApplication subclass: GSMTestphoneApp [
|
|||
e build: self lu.
|
||||
].
|
||||
]
|
||||
|
||||
loginContents [
|
||||
<category: 'building'>
|
||||
^[:e |
|
||||
e form build: [:form |
|
||||
form input action: [:val | self login: val].
|
||||
form button text: 'Login']]
|
||||
]
|
||||
|
||||
login: aString [
|
||||
<category: 'actions'>
|
||||
self session username: aString.
|
||||
self redirectToCurrentController
|
||||
]
|
||||
|
||||
dispatchOverride [
|
||||
<category: 'dispatching'>
|
||||
^self session isAuthenticated
|
||||
ifFalse: [self loginContents]
|
||||
ifTrue: [super dispatchOverride]
|
||||
]
|
||||
]
|
||||
|
||||
Eval [
|
||||
|
|
Reference in New Issue