mirror of
https://github.com/kakwa/ldapcherry
synced 2024-11-22 09:24:21 +01:00
add a default handler for 404 requests
This commit is contained in:
parent
1b7473d01c
commit
c64bb11504
@ -359,7 +359,7 @@ class LdapCherry(object):
|
|||||||
)
|
)
|
||||||
# load each template
|
# load each template
|
||||||
self.temp = {}
|
self.temp = {}
|
||||||
for t in ('index.tmpl', 'error.tmpl', 'login.tmpl',
|
for t in ('index.tmpl', 'error.tmpl', 'login.tmpl', '404.tmpl',
|
||||||
'searchadmin.tmpl', 'searchuser.tmpl', 'adduser.tmpl',
|
'searchadmin.tmpl', 'searchuser.tmpl', 'adduser.tmpl',
|
||||||
'roles.tmpl', 'groups.tmpl', 'form.tmpl', 'selfmodify.tmpl',
|
'roles.tmpl', 'groups.tmpl', 'form.tmpl', 'selfmodify.tmpl',
|
||||||
'modify.tmpl', 'service_unavailable.tmpl'
|
'modify.tmpl', 'service_unavailable.tmpl'
|
||||||
@ -1066,6 +1066,17 @@ class LdapCherry(object):
|
|||||||
notifications=self._empty_notification(),
|
notifications=self._empty_notification(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@cherrypy.expose
|
||||||
|
@exception_decorator
|
||||||
|
def default(self, attr=''):
|
||||||
|
cherrypy.response.status = 404
|
||||||
|
self._check_auth(must_admin=False)
|
||||||
|
is_admin = self._check_admin()
|
||||||
|
return self.temp['404.tmpl'].render(
|
||||||
|
is_admin=is_admin,
|
||||||
|
notifications=self._empty_notification(),
|
||||||
|
)
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
@exception_decorator
|
@exception_decorator
|
||||||
def selfmodify(self, **params):
|
def selfmodify(self, **params):
|
||||||
|
7
resources/templates/404.tmpl
Normal file
7
resources/templates/404.tmpl
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
## -*- coding: utf-8 -*-
|
||||||
|
<%inherit file="navbar.tmpl"/>
|
||||||
|
<%block name="core">
|
||||||
|
<div class="alert alert-warning alert-dismissible" role="alert">
|
||||||
|
<strong>404 Page not found,</strong> URL not available
|
||||||
|
</div>
|
||||||
|
</%block>
|
Loading…
Reference in New Issue
Block a user