Add IP bans
Users can be banned by IP address now, either by singular IP or in an IP range. If they are banned and attempt to post, they will be met with a "you are banned until X date" screen. There are a few loose threads with this, and IP bans may be obsolete if I decide to go the accounts-required-for-posting route. But I think this is a good start for 4chan style posting. Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
81
board/templates/board/banned.html
Normal file
81
board/templates/board/banned.html
Normal file
@@ -0,0 +1,81 @@
|
||||
{% extends "board/base.html" %}
|
||||
|
||||
{% block title %}
|
||||
{% if bans %}
|
||||
{% with title="Banned" %}
|
||||
{{ block.super }}
|
||||
{% endwith %}
|
||||
{% else %}
|
||||
{% with title="Not banned" %}
|
||||
{{ block.super }}
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
{% endblock title %}
|
||||
|
||||
{% block extrastyle %}
|
||||
{{block.super}}
|
||||
<style>
|
||||
.blankcolumn {
|
||||
float: left;
|
||||
width: 20%;
|
||||
}
|
||||
.bancolumn {
|
||||
float: left;
|
||||
width: 60%;
|
||||
}
|
||||
</style>
|
||||
{% endblock extrastyle %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="blankcolumn"> </div>
|
||||
<div class="bancolumn">
|
||||
{% if bans %}
|
||||
<div class="row">
|
||||
<h2>You are banned.</h2>
|
||||
</div>
|
||||
<div class="row">
|
||||
<p>
|
||||
You have been banned, and you are not allowed to post until your
|
||||
bans have expired.
|
||||
</p>
|
||||
<p>
|
||||
<strong>Your IP address:</strong> {{ip}}
|
||||
</p>
|
||||
</div>
|
||||
<hr />
|
||||
{% for ban in bans %}
|
||||
<div class="row">
|
||||
<p>
|
||||
<strong>Board:</strong>
|
||||
{% if ban.board %}
|
||||
/{{ ban.board.url }}/ - {{ ban.board.name }}
|
||||
{% else %}
|
||||
All boards
|
||||
{% endif %}
|
||||
</p>
|
||||
<p>
|
||||
<strong>Ban reason:</strong>
|
||||
</p>
|
||||
<p>{{ban.ban_reason}}</p>
|
||||
<p><strong>
|
||||
{% if ban.expires %}
|
||||
This ban will expire on {{ban.expires|date:"M dS"}} at {{ban.expires|date:"P e"}}
|
||||
{% else %}
|
||||
This ban will not expire.
|
||||
{% endif %}
|
||||
</strong></p>
|
||||
</div>
|
||||
<hr />
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<div class="row">
|
||||
<h2>You are not banned.</h2>
|
||||
</div>
|
||||
<div class="row">
|
||||
<p>You have no bans recorded for your IP address.</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="blankcolumn"> </div>
|
||||
{% endblock %}
|
||||
@@ -7,9 +7,11 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<title>{% block title %}{% if title %}{{title}}{% else %}Index{% endif %}{% endblock %}</title>
|
||||
<link rel="stylesheet" href="{% static 'board/style.css' %}">
|
||||
{% block extrastyle %}{% endblock %}
|
||||
<script src="{% static 'board/jquery.js' %}"></script>
|
||||
<script src="{% static 'board/winbox.bundle.js' %}"></script>
|
||||
<script src="{% static 'board/post.js' %}"></script>
|
||||
{% block extrajs %}{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
|
||||
Reference in New Issue
Block a user