5
|
1 |
object Application extends Controller {
|
|
2 |
|
|
3 |
// presenting login form
|
|
4 |
val index = Action { request =>
|
|
5 |
|
|
6 |
val form = """<form method="post">
|
|
7 |
Login: <input type="text" name="login"><br>
|
|
8 |
Password: <input type="password" name="password"><br>
|
|
9 |
<input type="submit"></form>"""
|
|
10 |
|
|
11 |
Ok(form).as(HTML)
|
|
12 |
}
|
|
13 |
|
|
14 |
|
|
15 |
// processing the received login data
|
|
16 |
val receive = Action { request =>
|
|
17 |
|
|
18 |
val form_data = Form (tuple ("login" -> text, "password" -> text))
|
|
19 |
|
|
20 |
val (login, password) = form_data.bindFromRequest()(request).get
|
|
21 |
|
|
22 |
Ok("Received login: " + login + " and password: " + password)
|
|
23 |
}
|
|
24 |
|
|
25 |
}
|
|
26 |
|
|
27 |
|
|
28 |
|