author | Christian Urban <christian dot urban at kcl dot ac dot uk> |
Mon, 23 Sep 2013 22:23:55 +0100 | |
changeset 98 | 3d585e603927 |
parent 93 | 82ac034dcc9d |
permissions | -rw-r--r-- |
5 | 1 |
object Application extends Controller { |
2 |
||
6 | 3 |
// GET request -> present login form |
5 | 4 |
val index = Action { request => |
5 |
||
6 | 6 |
val form = |
7 |
"""<form method="post"> |
|
8 |
Login: <input type="text" name="login"><br> |
|
9 |
Password: <input type="password" name="password"><br> |
|
10 |
<input type="submit"></form>""" |
|
5 | 11 |
|
12 |
Ok(form).as(HTML) |
|
13 |
} |
|
14 |
||
6 | 15 |
// POST data: processing the login data |
5 | 16 |
val receive = Action { request => |
17 |
||
98
3d585e603927
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
18 |
val form_data = Form(tuple ("login" -> text, "password" -> text)) |
3d585e603927
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
19 |
def (login, passwd) = form_data.bindFromRequest()(request).get |
5 | 20 |
|
98
3d585e603927
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
21 |
Ok(s"Received login: $login and password: $passwd") |
5 | 22 |
} |
23 |
} |
|
24 |
||
25 |
||
26 |