2
0
Fork 0

Redact login token

This commit is contained in:
Luca 2023-05-08 20:58:08 +02:00
parent 0cd9f661c7
commit 8e3726eba4
5 changed files with 15 additions and 3 deletions

View File

@ -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>

View File

@ -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 %}

View File

@ -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>

View File

@ -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)