Redact login token

pull/1/head
Luca 2 years ago
parent 0cd9f661c7
commit 8e3726eba4

@ -1,6 +1,7 @@
{% extends "base.html" %}
{% load humanize %}
{% load striplogintoken %}
{% block title %}Helferdetails{% endblock %}
@ -22,7 +23,7 @@
<div class="message{% if not read %} is-info{% endif %} mb-5 {% if incoming %}message-incoming{% else %}{% if not created_at %}is-warning{% else %}is-primary{% endif %} message-outgoing{% endif %}">
<div class="message-body">
<div class="is-flex is-flex-wrap-wrap">
{{ content }}
{{ content | striplogintoken }}
{% if created_at %}
<div class="has-text-right is-flex-grow-1">
<small>{{ created_at | naturaltime }}</small>

@ -1,6 +1,7 @@
{% extends "base.html" %}
{% load humanize %}
{% load striplogintoken %}
{% block title %}Nachricht von {{ message.sender }}{% endblock %}
@ -11,7 +12,7 @@
</div>
<div class="message mb-5">
<div class="message-body">
{{ message.content }}
{{ message.content | striplogintoken }}
</div>
</div>
{% if not message.read %}

@ -1,6 +1,7 @@
{% extends "base.html" %}
{% load humanize %}
{% load striplogintoken %}
{% block title %}Sie haben {{ num_unread | apnumber }} neue Nachricht{{ num_unread | pluralize:"en" }}{% endblock %}
@ -13,7 +14,7 @@
{{ message.display_sender }} <small>{{ message.created_at | naturaltime }}</small>
</div>
<div class="message-body">
{{ message.content }}
{{ message.content | striplogintoken }}
</div>
</div>
</a>

@ -0,0 +1,9 @@
from django import template
from re import ASCII, sub
register = template.Library()
@register.filter(name="striplogintoken")
def strip_login_token(value):
return sub(r'https://helfen\.kntkt\.de/l/[-\w]+', '(zurückbehalten)', value, flags=ASCII)
Loading…
Cancel
Save