Commit 8e6e4e6d authored by Pietro Albini's avatar Pietro Albini

Add a nice 403 page

parent 0636d2d9
Pipeline #77 passed with stage
in 0 seconds
...@@ -67,6 +67,10 @@ def create_app(data_path): ...@@ -67,6 +67,10 @@ def create_app(data_path):
nav.add_generator("download-distros", app.download.generate_navbar) nav.add_generator("download-distros", app.download.generate_navbar)
nav.install(app) nav.install(app)
@app.errorhandler(403)
def forbidden(error):
return flask.render_template("403.html"), 403
@app.errorhandler(404) @app.errorhandler(404)
def not_found(error): def not_found(error):
return flask.render_template("404.html"), 404 return flask.render_template("404.html"), 404
......
{# Source code of the Ubuntu-it website
# Copyright (C) 2018 Pietro Albini <pietroalbini@ubuntu.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; witout even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "layout.html" %}
{% block title %}Accesso negato{% endblock %}
{% block content %}
<div class="page">
<div class="row">
<div class="col">
<h1>Accesso negato</h1>
{% if g.auth_id %}
<p>
Il tuo gruppo non dispone dei permessi necessari per
visualizzare questa pagina.
</p>
{% else %}
<p>
Questa pagina è riservata ai membri di Ubuntu-it con
adeguati permessi. <a href="{{ url_for("auth.login") }}">
Effettua l'accesso</a> per visualizzarla.
</p>
{% endif %}
</div>
</div>
</div>
{% endblock %}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment