0
|
1 local Luan = require "luan:Luan.luan"
|
|
2 local error = Luan.error
|
|
3 local Io = require "luan:Io.luan"
|
|
4 local Http = require "luan:http/Http.luan"
|
|
5 local Shared = require "site:/lib/Shared.luan"
|
|
6 local head = Shared.head or error()
|
|
7 local header = Shared.header or error()
|
5
|
8 local Utils = require "site:/lib/Utils.luan"
|
|
9 local base_url = Utils.base_url or error()
|
|
10 local User = require "site:/lib/User.luan"
|
|
11 local current_user = User.current_required or error()
|
0
|
12
|
|
13
|
|
14 return function()
|
5
|
15 local user = current_user()
|
|
16 if user == nil then return end
|
0
|
17 Io.stdout = Http.response.text_writer()
|
|
18 %>
|
|
19 <!doctype html>
|
|
20 <html>
|
|
21 <head>
|
|
22 <% head() %>
|
20
|
23 <script>
|
|
24 'use strict';
|
|
25
|
|
26 function deleteUser() {
|
|
27 let dialog = document.querySelector('dialog[delete_user]');
|
|
28 openModal(dialog);
|
|
29 }
|
|
30
|
|
31 function doDeleteUser(el) {
|
|
32 closeModal(el);
|
|
33 ajax('delete_user.js');
|
|
34 }
|
|
35 </script>
|
0
|
36 </head>
|
|
37 <body>
|
|
38 <% header() %>
|
|
39 <div content>
|
3
|
40 <h1>Your Account</h1>
|
4
|
41 <p><a href="chat.html">Your Chats</a></p>
|
5
|
42 <p>Your URL: <%= base_url() %>/chat.html?with=<%=user.email%></p>
|
20
|
43 <p><a href="javascript:deleteUser()">Delete account</a></p>
|
3
|
44 <p><a href="javascript:logout()">Logout</a></p>
|
0
|
45 </div>
|
20
|
46 <dialog delete_user>
|
|
47 <h2>Delete Account</h2>
|
|
48 <p>Are you sure that you want to delete your account?</p>
|
|
49 <div buttons>
|
|
50 <button cancel onclick="closeModal(this)">Cancel</button>
|
|
51 <button go onclick="doDeleteUser(this)">Delete</button>
|
|
52 </div>
|
|
53 </dialog>
|
0
|
54 </body>
|
|
55 </html>
|
|
56 <%
|
|
57 end
|