1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-11-22 01:14:21 +01:00

add a default handler for 404 requests

This commit is contained in:
kakwa 2016-07-06 22:50:59 +02:00
parent 1b7473d01c
commit c64bb11504
2 changed files with 19 additions and 1 deletions

View File

@ -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):

View 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>