webmcp
view demo-app/app/main/_filter/21_auth.lua @ 2:72860d232f32
Version 1.0.2
Fixed bug with explicit garbage collection (requests > 256kB caused an error)
Views prefixed with an underscore can't be called externally
ui.paginate now displays the last page, if the selected page number is too high.
Fixed bug with explicit garbage collection (requests > 256kB caused an error)
Views prefixed with an underscore can't be called externally
ui.paginate now displays the last page, if the selected page number is too high.
author | jbe/bsw |
---|---|
date | Thu Dec 10 12:00:00 2009 +0100 (2009-12-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