1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
-- Checking script example
-- Assumes that the login form will use two fields called username and pass
local username = cgilua.POST.username
local pass = cgilua.POST.pass
local logged, err, logoutURL
if cgilua.authentication then
logged, err = cgilua.authentication.check(username, pass)
username = cgilua.authentication.username() or ""
logoutURL = cgilua.authentication.logoutURL()
else
logged = false
err = "No authentication configured!"
username = ""
end
if logged and username then
cgilua.redirect(cgilua.authentication.refURL())
else
err = err or ""
cgilua.htmlheader()
cgilua.lp.include ("login.lp", {
logged = logged, errorMsg = err, username = username,
cgilua = cgilua, logoutURL = logoutURL})
end
|