comparison src/private/tools/delete_user.html.luan @ 4:028e74c8889d

add all_users
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 12 May 2022 16:54:11 -0600
parents
children
comparison
equal deleted inserted replaced
3:e3448053230a 4:028e74c8889d
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.private_header or error()
8 local config = Shared.config or error()
9 local user_repos = Shared.user_repos or error()
10 local get_raw_config = Shared.get_raw_config or error()
11 local save_raw_config = Shared.save_raw_config or error()
12
13
14 local function handle()
15 local user = Http.request.parameters.user or error()
16 user_repos[user] and error "has repos"
17 local raw_config = get_raw_config()
18 raw_config.users[user] = nil
19 save_raw_config(raw_config)
20 return [[<p>User <b>]]..user..[[</b> has been deleted</p>]]
21 end
22
23 return function()
24 Io.stdout = Http.response.text_writer()
25 %>
26 <!doctype html>
27 <html>
28 <head>
29 <% head() %>
30 <title>Delete Mercurial User</title>
31 </head>
32 <body>
33 <% header() %>
34 <div content>
35 <h1>Delete User</h1>
36 <%=handle()%>
37 </div>
38 </body>
39 </html>
40 <%
41 end