annotate src/private/tools/delete_user.html.luan @ 20:8b4481769cc6

fix move logs
author Vadim Filimonov <fffilimonov@yandex.ru>
date Mon, 05 Aug 2024 11:32:22 +0300
parents 028e74c8889d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1 local Luan = require "luan:Luan.luan"
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2 local error = Luan.error
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
3 local Io = require "luan:Io.luan"
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
4 local Http = require "luan:http/Http.luan"
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5 local Shared = require "site:/lib/Shared.luan"
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6 local head = Shared.head or error()
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
7 local header = Shared.private_header or error()
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8 local config = Shared.config or error()
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9 local user_repos = Shared.user_repos or error()
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10 local get_raw_config = Shared.get_raw_config or error()
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11 local save_raw_config = Shared.save_raw_config or error()
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
12
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
13
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14 local function handle()
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
15 local user = Http.request.parameters.user or error()
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
16 user_repos[user] and error "has repos"
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
17 local raw_config = get_raw_config()
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
18 raw_config.users[user] = nil
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
19 save_raw_config(raw_config)
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
20 return [[<p>User <b>]]..user..[[</b> has been deleted</p>]]
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
21 end
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
22
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
23 return function()
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
24 Io.stdout = Http.response.text_writer()
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
25 %>
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
26 <!doctype html>
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
27 <html>
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
28 <head>
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
29 <% head() %>
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
30 <title>Delete Mercurial User</title>
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
31 </head>
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
32 <body>
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
33 <% header() %>
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
34 <div content>
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
35 <h1>Delete User</h1>
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
36 <%=handle()%>
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
37 </div>
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
38 </body>
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
39 </html>
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
40 <%
028e74c8889d add all_users
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
41 end