webmcp

view demo-app/app/main/_filter/21_auth.lua @ 117:82c1daccd7cf

Default to "lua" and "luac" binaries in Makefile.options
author jbe
date Thu Jul 10 00:27:22 2014 +0200 (2014-07-10)
parents 9fdfb27f8e67
children
line source
1 local auth_needed = not (
2 request.get_module() == 'index'
3 and (
4 request.get_view() == 'login'
5 or request.get_action() == 'login'
6 )
7 )
9 -- if not app.session.user_id then
10 -- trace.debug("DEBUG: AUTHENTICATION BYPASS ENABLED")
11 -- app.session.user_id = 1
12 -- end
14 if app.session.user == nil and auth_needed then
15 trace.debug("Not authenticated yet.")
16 request.redirect{ module = 'index', view = 'login' }
17 else
18 if auth_needed then
19 trace.debug("Authentication accepted.")
20 else
21 trace.debug("No authentication needed.")
22 end
23 execute.inner()
24 trace.debug("End of authentication filter.")
25 end

Impressum / About Us