diff --git a/examples/authentication_conf.lua b/examples/authentication_conf.lua index 02ef655..df710fe 100755 --- a/examples/authentication_conf.lua +++ b/examples/authentication_conf.lua @@ -6,7 +6,7 @@ -- $Id: authentication_conf.lua,v 1.1 2007/12/05 18:40:17 carregal Exp $ ---------------------------- -require"cgilua.authentication" +cgilua.authentication = require"cgilua.authentication" local options = { -- Authentication method: "simpledatabase", "webserver", "ldap", "test" @@ -14,7 +14,7 @@ local options = { -- How Authentication is stored on the client -- This directive can be "cookie" or "url" - tokenPersistence="url", + tokenPersistence="cookie", -- Name used for the token persitence tokenName = "userhash", @@ -35,7 +35,7 @@ options.simpledatabase = { sourcename="users", dbusername="root", dbpassword="pass", - passwd_hash_function=(require"md5") and md5.sumhexa, -- for MD5 encription + passwd_hash_function=(require"md5") and require("md5").sumhexa, -- for MD5 encription -- passwd_hash_function = function(arg) return arg end , -- for no encription users_table="Users", user_name_field="Name", diff --git a/examples/cgilua/config.lua b/examples/cgilua/config.lua index dc3e599..d0fbb66 100755 --- a/examples/cgilua/config.lua +++ b/examples/cgilua/config.lua @@ -8,7 +8,7 @@ -- cgilua.use_executable_name = true -- Enables CGILua authentication --- cgilua.doif (CGILUA_CONF.."/authentication_conf.lua") +cgilua.doif (CGILUA_CONF.."/../authentication_conf.lua") -- Emulating old behavior loading file "env.lua" from the script's directory --[[ @@ -18,8 +18,7 @@ end) --]] -- Basic configuration for using sessions ---[[ -require"cgilua.session" +cgilua.session = require"cgilua.session" cgilua.session.setsessiondir (CGILUA_TMP) -- The following function must be called by every script that needs session. local already_enabled = false @@ -32,7 +31,9 @@ function cgilua.enablesession () cgilua.session.open () cgilua.addclosefunction (cgilua.session.close) end ---]] + +cgilua.setmaxinput(5 * 1024 * 1024) +cgilua.setmaxfilesize(5 * 1024 * 1024) -- Optional compatibility values -- cgilua.preprocess = cgilua.handlelp diff --git a/examples/check.lua b/examples/check.lua index ba6efc3..5fa928a 100755 --- a/examples/check.lua +++ b/examples/check.lua @@ -1,6 +1,7 @@ -- Checking script example -- Assumes that the login form will use two fields called username and pass +local lp = require 'cgilua.lp' local username = cgilua.POST.username local pass = cgilua.POST.pass local logged, err, logoutURL @@ -21,7 +22,7 @@ else err = err or "" cgilua.htmlheader() - cgilua.lp.include ("login.lp", { + lp.include ("login.lp", { logged = logged, errorMsg = err, username = username, cgilua = cgilua, logoutURL = logoutURL}) end diff --git a/examples/login.lp b/examples/login.lp index c4220f4..d886ddd 100755 --- a/examples/login.lp +++ b/examples/login.lp @@ -4,6 +4,9 @@
+ <% + cgilua.enablesession () + %> <% if logged then %>User <%= username %> logged in
Logout @@ -17,4 +20,4 @@ <% end %> -