diff --git a/ldapcherry/__init__.py b/ldapcherry/__init__.py index 1c5bee2..fc99f5c 100644 --- a/ldapcherry/__init__.py +++ b/ldapcherry/__init__.py @@ -359,7 +359,7 @@ class LdapCherry(object): ) # load each template 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', 'roles.tmpl', 'groups.tmpl', 'form.tmpl', 'selfmodify.tmpl', 'modify.tmpl', 'service_unavailable.tmpl' @@ -1066,6 +1066,17 @@ class LdapCherry(object): 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 @exception_decorator def selfmodify(self, **params): diff --git a/resources/templates/404.tmpl b/resources/templates/404.tmpl new file mode 100644 index 0000000..b54ed26 --- /dev/null +++ b/resources/templates/404.tmpl @@ -0,0 +1,7 @@ +## -*- coding: utf-8 -*- +<%inherit file="navbar.tmpl"/> +<%block name="core"> + +