annotate src/account.html.luan @ 5:a49866b52cc2

login to chat
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 29 Oct 2024 13:10:47 -0600
parents 2da10ece826f
children e22a1ba4b2ed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1 local Luan = require "luan:Luan.luan"
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2 local error = Luan.error
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
3 local Io = require "luan:Io.luan"
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
4 local Http = require "luan:http/Http.luan"
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5 local Shared = require "site:/lib/Shared.luan"
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6 local head = Shared.head or error()
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
7 local header = Shared.header or error()
5
a49866b52cc2 login to chat
Franklin Schmidt <fschmidt@gmail.com>
parents: 4
diff changeset
8 local Utils = require "site:/lib/Utils.luan"
a49866b52cc2 login to chat
Franklin Schmidt <fschmidt@gmail.com>
parents: 4
diff changeset
9 local base_url = Utils.base_url or error()
a49866b52cc2 login to chat
Franklin Schmidt <fschmidt@gmail.com>
parents: 4
diff changeset
10 local User = require "site:/lib/User.luan"
a49866b52cc2 login to chat
Franklin Schmidt <fschmidt@gmail.com>
parents: 4
diff changeset
11 local current_user = User.current_required or error()
0
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
12
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
13
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14 return function()
5
a49866b52cc2 login to chat
Franklin Schmidt <fschmidt@gmail.com>
parents: 4
diff changeset
15 local user = current_user()
a49866b52cc2 login to chat
Franklin Schmidt <fschmidt@gmail.com>
parents: 4
diff changeset
16 if user == nil then return end
0
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
17 Io.stdout = Http.response.text_writer()
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
18 %>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
19 <!doctype html>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
20 <html>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
21 <head>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
22 <% head() %>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
23 </head>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
24 <body>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
25 <% header() %>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
26 <div content>
3
2c63b10781e1 add login
Franklin Schmidt <fschmidt@gmail.com>
parents: 2
diff changeset
27 <h1>Your Account</h1>
4
2da10ece826f add Chat
Franklin Schmidt <fschmidt@gmail.com>
parents: 3
diff changeset
28 <p><a href="chat.html">Your Chats</a></p>
5
a49866b52cc2 login to chat
Franklin Schmidt <fschmidt@gmail.com>
parents: 4
diff changeset
29 <p>Your URL: <%= base_url() %>/chat.html?with=<%=user.email%></p>
3
2c63b10781e1 add login
Franklin Schmidt <fschmidt@gmail.com>
parents: 2
diff changeset
30 <p><a href="javascript:logout()">Logout</a></p>
0
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
31 </div>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
32 </body>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
33 </html>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
34 <%
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
35 end