|
0
|
1 local Luan = require "luan:Luan.luan"
|
|
|
2 local error = Luan.error
|
|
5
|
3 local ipairs = Luan.ipairs or error()
|
|
0
|
4 local Io = require "luan:Io.luan"
|
|
|
5 local Http = require "luan:http/Http.luan"
|
|
|
6 local Shared = require "site:/lib/Shared.luan"
|
|
|
7 local head = Shared.head or error()
|
|
|
8 local header = Shared.header or error()
|
|
117
|
9 local hidden_with = Shared.hidden_with or error()
|
|
|
10 local add_with = Shared.add_with or error()
|
|
0
|
11
|
|
|
12
|
|
|
13 return function()
|
|
117
|
14 local email = Http.request.parameters.email
|
|
|
15 local password = Http.request.parameters.password
|
|
0
|
16 Io.stdout = Http.response.text_writer()
|
|
|
17 %>
|
|
|
18 <!doctype html>
|
|
94
|
19 <html lang="en">
|
|
0
|
20 <head>
|
|
|
21 <% head() %>
|
|
40
|
22 <style>
|
|
|
23 input[name=email] {
|
|
|
24 width: 300px;
|
|
|
25 max-width: 100%;
|
|
|
26 }
|
|
44
|
27 [failed] {
|
|
|
28 color: red;
|
|
|
29 }
|
|
40
|
30 </style>
|
|
0
|
31 </head>
|
|
|
32 <body>
|
|
|
33 <% header() %>
|
|
|
34 <div content>
|
|
117
|
35 <h1>Login</h1>
|
|
|
36 <form page onsubmit="ajaxForm('/login.js',this)" action="javascript:">
|
|
|
37 <% if Http.request.parameters.spy ~= nil then %>
|
|
|
38 <input type=hidden name=spy>
|
|
|
39 <% end
|
|
|
40 hidden_with() %>
|
|
3
|
41 <p>
|
|
|
42 <label prompt>Your email address</label>
|
|
117
|
43 <input type=email name=email required autofocus value="<%= email or "" %>">
|
|
3
|
44 </p>
|
|
|
45 <p>
|
|
44
|
46 <label prompt>Password</label>
|
|
117
|
47 <input name=password type=password required value="<%= password or "" %>">
|
|
44
|
48 </p>
|
|
|
49 <p>
|
|
3
|
50 <input type=submit>
|
|
|
51 </p>
|
|
44
|
52 <p failed></p>
|
|
3
|
53 </form>
|
|
117
|
54 <p><a href="<%= add_with("register.html") %>">Register / Get Password</a></p>
|
|
|
55 <p><a href="about.html">About Luan Chat</a></p>
|
|
0
|
56 </div>
|
|
|
57 </body>
|
|
|
58 </html>
|
|
|
59 <%
|
|
|
60 end
|