Mercurial Hosting > chat
comparison src/login.html.luan @ 117:e2deb5236f26
better login
| author | Franklin Schmidt <fschmidt@gmail.com> |
|---|---|
| date | Thu, 04 Dec 2025 21:43:47 -0700 |
| parents | src/manual_login.html.luan@8c3b56bb0c83 |
| children |
comparison
equal
deleted
inserted
replaced
| 116:98b2dc732ca0 | 117:e2deb5236f26 |
|---|---|
| 1 local Luan = require "luan:Luan.luan" | 1 local Luan = require "luan:Luan.luan" |
| 2 local error = Luan.error | 2 local error = Luan.error |
| 3 local ipairs = Luan.ipairs or error() | 3 local ipairs = Luan.ipairs or error() |
| 4 local Html = require "luan:Html.luan" | |
| 5 local html_encode = Html.encode or error() | |
| 6 local Io = require "luan:Io.luan" | 4 local Io = require "luan:Io.luan" |
| 7 local Http = require "luan:http/Http.luan" | 5 local Http = require "luan:http/Http.luan" |
| 8 local Shared = require "site:/lib/Shared.luan" | 6 local Shared = require "site:/lib/Shared.luan" |
| 9 local head = Shared.head or error() | 7 local head = Shared.head or error() |
| 10 local header = Shared.header or error() | 8 local header = Shared.header or error() |
| 11 local Utils = require "site:/lib/Utils.luan" | 9 local hidden_with = Shared.hidden_with or error() |
| 12 local to_list = Utils.to_list or error() | 10 local add_with = Shared.add_with or error() |
| 13 | 11 |
| 14 | 12 |
| 15 return function() | 13 return function() |
| 16 local with = Http.request.parameters.with | 14 local email = Http.request.parameters.email |
| 17 with = to_list(with) | 15 local password = Http.request.parameters.password |
| 18 Io.stdout = Http.response.text_writer() | 16 Io.stdout = Http.response.text_writer() |
| 19 %> | 17 %> |
| 20 <!doctype html> | 18 <!doctype html> |
| 21 <html lang="en"> | 19 <html lang="en"> |
| 22 <head> | 20 <head> |
| 24 <style> | 22 <style> |
| 25 input[name=email] { | 23 input[name=email] { |
| 26 width: 300px; | 24 width: 300px; |
| 27 max-width: 100%; | 25 max-width: 100%; |
| 28 } | 26 } |
| 27 [failed] { | |
| 28 color: red; | |
| 29 } | |
| 29 </style> | 30 </style> |
| 30 </head> | 31 </head> |
| 31 <body> | 32 <body> |
| 32 <% header() %> | 33 <% header() %> |
| 33 <div content> | 34 <div content> |
| 34 <h1>Login / Register</h1> | 35 <h1>Login</h1> |
| 35 <p>A link to login will be emailed to you.</p> | |
| 36 <form page onsubmit="ajaxForm('/login.js',this)" action="javascript:"> | 36 <form page onsubmit="ajaxForm('/login.js',this)" action="javascript:"> |
| 37 <% for _, email in ipairs(with) do %> | 37 <% if Http.request.parameters.spy ~= nil then %> |
| 38 <input type=hidden name=with value="<%=html_encode(email)%>"> | 38 <input type=hidden name=spy> |
| 39 <% end %> | 39 <% end |
| 40 hidden_with() %> | |
| 40 <p> | 41 <p> |
| 41 <label prompt>Your email address</label> | 42 <label prompt>Your email address</label> |
| 42 <input type=email name=email required autofocus> | 43 <input type=email name=email required autofocus value="<%= email or "" %>"> |
| 44 </p> | |
| 45 <p> | |
| 46 <label prompt>Password</label> | |
| 47 <input name=password type=password required value="<%= password or "" %>"> | |
| 43 </p> | 48 </p> |
| 44 <p> | 49 <p> |
| 45 <input type=submit> | 50 <input type=submit> |
| 46 </p> | 51 </p> |
| 52 <p failed></p> | |
| 47 </form> | 53 </form> |
| 48 <p><a href="manual_login.html">Password Login</a></p> | 54 <p><a href="<%= add_with("register.html") %>">Register / Get Password</a></p> |
| 49 <p><a href="about.html">About Luan Chat</a></p> | 55 <p><a href="about.html">About Luan Chat</a></p> |
| 50 </div> | 56 </div> |
| 51 </body> | 57 </body> |
| 52 </html> | 58 </html> |
| 53 <% | 59 <% |
