]> git.ipfire.org Git - ipfire.org.git/commitdiff
Add blocked page
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 18 Oct 2018 11:29:31 +0000 (12:29 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 18 Oct 2018 11:29:31 +0000 (12:29 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/templates/static/blocked.html [new file with mode: 0644]
src/web/__init__.py
src/web/handlers_base.py

index f5bc4f17da73ca5a036c02ea05ab1086ada5f1f8..1424e8247b1e78cd93cc5eb09416db77c307c289 100644 (file)
@@ -187,6 +187,7 @@ templates_people_ssh_keys_DATA = \
 templates_people_ssh_keysdir = $(templates_peopledir)/ssh-keys
 
 templates_static_DATA = \
+       src/templates/static/blocked.html \
        src/templates/static/chat.html \
        src/templates/static/features.html \
        src/templates/static/legal.html \
diff --git a/src/templates/static/blocked.html b/src/templates/static/blocked.html
new file mode 100644 (file)
index 0000000..24f440f
--- /dev/null
@@ -0,0 +1,26 @@
+{% extends "../base.html" %}
+
+{% block title %}{{ _("You have been blocked") }}{% end block %}
+
+{% block container %}
+    <div class="container">
+               <div class="row justify-content-center mt-5">
+                       <div class="col col-md-5">
+                               <h5 class="mb-0">{{ _("Oops") }}</h5>
+                <h1>{{ _("You have been blocked") }}</h1>
+
+                <p>
+                    {{ _("Your request has been blocked because your IP address is suspected to spread spam.") }}
+                </p>
+
+                <p>
+                    <a href="https://location.ipfire.org/lookup/{{ address }}">
+                        {{ _("Click here to find out more about the status of your IP address") }}
+                    </a>
+                </p>
+                       </div>
+               </div>
+       </div>
+{% end %}
+
+{% block footer %}{% end block %}
index e721dbfaa9fbf387315d14e91b48e4f9855fc7a4..7072108c19173ff5bf24dfaaa5573789b3630dad 100644 (file)
@@ -126,6 +126,9 @@ class Application(tornado.web.Application):
 
                        # Export arbitrary error pages
                        (r"/error/([45][0-9]{2})", ErrorHandler),
+
+                       # Block page
+                       (r"/blocked", BlockedHandler),
                ])
 
                # blog.ipfire.org
index 41692c41c1149a37fb39b27a14d1912fa78df57b..26fc43e7b6f06564f67145df88cbdc376422e901 100644 (file)
@@ -196,3 +196,11 @@ class ErrorHandler(BaseHandler):
                        raise tornado.web.HTTPError(400)
 
                raise tornado.web.HTTPError(code)
+
+
+class BlockedHandler(BaseHandler):
+       def get(self):
+               # 403 - Forbidden
+               self.set_status(403)
+
+               self.render("static/blocked.html", address=self.get_remote_ip())