mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-17 19:59:29 +00:00
More helpful Blacklist form, allows for users to set the level of blacklist.
This commit is contained in:
@@ -96,6 +96,7 @@ class BlacklistUserForm(forms.Form):
|
|||||||
""" A form to capture the reasons for blacklisting a user
|
""" A form to capture the reasons for blacklisting a user
|
||||||
and the related expiry date """
|
and the related expiry date """
|
||||||
|
|
||||||
reason = forms.CharField(required=True, widget=forms.widgets.Textarea())
|
level = forms.ChoiceField(label="Blacklist Level", required=True, choices=BLACKLIST_LEVEL_CHOICES, help_text="The level of entry to be added to the account")
|
||||||
expiry_date = forms.DateTimeField(required=False, widget=SelectDateWidget())
|
reason = forms.CharField(label="Reason / Description", required=True, widget=forms.widgets.Textarea(), help_text="Brief description of why this account is being blacklisted")
|
||||||
disable = forms.BooleanField(required=False)
|
expiry_date = forms.DateTimeField(label="Expiry Date", required=False, widget=SelectDateWidget(), help_text="The date on which the blacklist entry should expire")
|
||||||
|
disable = forms.BooleanField(label="Disable User?", required=False, help_text="Enabling this will disable the user's account once blacklisted")
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
{% block title %}Blacklist User{% endblock %}
|
{% block title %}Blacklist User{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
<h1>Add Blacklist</h1>
|
||||||
|
|
||||||
<p>This form will blacklist the listed user below. It'll process all entries for the user and blacklist the following:</p>
|
<p>This form will blacklist the listed user below. It'll process all entries for the user and blacklist the following:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>EVE API Keys</li>
|
<li>EVE API Keys</li>
|
||||||
|
|||||||
@@ -310,8 +310,11 @@ def blacklist_user(request, userid):
|
|||||||
else:
|
else:
|
||||||
expiry = form.cleaned_data['expiry_date']
|
expiry = form.cleaned_data['expiry_date']
|
||||||
|
|
||||||
|
level = form.cleaned_data.get('level', 0)
|
||||||
|
print level
|
||||||
|
|
||||||
def blacklist_item(type, value):
|
def blacklist_item(type, value):
|
||||||
o = Blacklist(type=type, value=value, source=source, expiry_date=expiry, created_by=request.user, reason=form.cleaned_data['reason'])
|
o = Blacklist(type=type, value=value, level=level, source=source, expiry_date=expiry, created_by=request.user, reason=form.cleaned_data['reason'])
|
||||||
o.save()
|
o.save()
|
||||||
|
|
||||||
for ea in u.eveaccount_set.all():
|
for ea in u.eveaccount_set.all():
|
||||||
|
|||||||
Reference in New Issue
Block a user