create htpasswd files after the turn. do not overwrite old password file (E2!)

This commit is contained in:
Enno Rehling 2016-02-09 08:41:23 +01:00
parent 1201a6b739
commit 188aa84011
1 changed files with 21 additions and 5 deletions

View File

@ -59,11 +59,16 @@ local function write_emails(locales)
end end
end end
local function join_path(a, b)
if a then return a .. '/' .. b
return b
end
local function write_addresses() local function write_addresses()
local file local file
local faction local faction
file = io.open(config.basepath .. "/adressen", "w") file = io.open(join_path(config.basepath, "adressen"), "w")
for faction in factions() do for faction in factions() do
-- print(faction.id .. " - " .. faction.locale) -- print(faction.id .. " - " .. faction.locale)
file:write(tostring(faction) .. ":" .. faction.email .. ":" .. faction.info .. "\n") file:write(tostring(faction) .. ":" .. faction.email .. ":" .. faction.info .. "\n")
@ -76,7 +81,7 @@ local function write_aliases()
local file local file
local faction local faction
file = io.open(config.basepath .. "/aliases", "w") file = io.open(join_path(config.basepath, "aliases"), "w")
for faction in factions() do for faction in factions() do
local unit local unit
if faction.email ~= "" then if faction.email ~= "" then
@ -90,10 +95,21 @@ local function write_aliases()
file:close() file:close()
end end
local function write_htpasswd()
local out = io.open(join_path(config.basepath, "htpasswd"), "w")
if out then
for f in factions() do
out:write(itoa36(f.id) .. ":" .. f.password .. "\n")
end
out:close()
end
end
local function write_files(locales) local function write_files(locales)
write_passwords() write_htpasswd()
write_reports() -- write_passwords()
write_summary() write_reports()
write_summary()
end end
local function write_scores() local function write_scores()