1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2020-2022 by the Free Software Foundation, Inc.
4 # This file is part of Postorius.
6 # Postorius is free software: you can redistribute it and/or modify it under
7 # the terms of the GNU General Public License as published by the Free
8 # Software Foundation, either version 3 of the License, or (at your option)
11 # Postorius is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 # You should have received a copy of the GNU General Public License along with
17 # Postorius. If not, see <http://www.gnu.org/licenses/>.
20 from django
import forms
21 from django
.utils
.translation
import gettext_lazy
as _
24 class AddBanForm(forms
.Form
):
25 """Ban an email address or regular expression."""
26 # TODO maxking: This form should only accept valid emails or regular
27 # expressions. Anything else that doesn't look like a valid email address
28 # or regexp for email should not be a valid value for the field. However,
29 # checking for that might not be easy.
30 email
= forms
.CharField(
33 'You can ban a single email address or use a regular expression '
34 'to match similar email addresses.'),
36 'required': _('Please enter an email address.'),
37 'invalid': _('Please enter a valid email address.')})