Captcha hinzugefügt und gecheckt

This commit is contained in:
holger.trampe 2020-10-21 18:43:34 +02:00
parent 8b23a6301b
commit 4b891f5829
7 changed files with 30 additions and 14 deletions

View File

@ -89,6 +89,7 @@ INSTALLED_APPS = [
'channels',
'channels_presence',
'simple_history',
'captcha'
]
MIDDLEWARE = [

View File

@ -42,6 +42,7 @@ urlpatterns = [
path('api-token-auth/', obtain_auth_token, name='api-token-auth'),
path('getdoc/<path:path>/<int:agpk>', GetCryptFileRecover.as_view(), name=FETCH_URL_NAME),
path('getdoc/<path:path>', GetCryptFile.as_view(), name=FETCH_URL_NAME),
path('captcha/', include('captcha.urls')),
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

View File

@ -31,4 +31,5 @@ python-dateutil==2.8.1
django-simple-history==2.11.0
django-encrypted-filefield==0.2.2
more-itertools==8.5.0
django-passwords==0.3.12
django-passwords==0.3.12
django-simple-captcha=0.5.13

View File

@ -25,22 +25,25 @@
</legend>
{% for field in form %}
{{field.field_name}}
{% if field.name == 'agb' %}
{{field}}&nbsp;&nbsp;<a style="" href="{% url 'datenschutzda' %}" target="_blank">AGB's*</a><br />
{% elif field.name == 'av' %}
{{field}}&nbsp;&nbsp;<a style="" href="{% url 'impressumda' %}" target="_blank">Auftragsverarbeitung*</a>
{% else %}
{{field|as_crispy_field}}
{% if field.name != 'captcha' %}
{{field.field_name}}
{% if field.name == 'agb' %}
{{field}}&nbsp;&nbsp;<a style="" href="{% url 'datenschutzda' %}" target="_blank">AGB's*</a><br />
{% elif field.name == 'av' %}
{{field}}&nbsp;&nbsp;<a style="" href="{% url 'impressumda' %}" target="_blank">Auftragsverarbeitung*</a>
{% else %}
{{field|as_crispy_field}}
{% endif %}
{% endif %}
{% endfor %}
<div class="form-check">
{{form.captcha|as_crispy_field}}
<!--<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="isvve" onclick="javascript:changeVVE()">
<label class="form-check-label" for="isvve">
VVE-Mitglied
</label>
</div>
</div>-->
</fieldset>
<div class="form-group">
<button type="submit" class="btn btn-success">Registrieren</button>
@ -49,7 +52,7 @@
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
/*$(document).ready(function(){
$("#div_id_vve").hide();
});
@ -61,6 +64,6 @@
} else {
$("#div_id_vve").hide();
}
}
}*/
</script>
{% endblock content %}

View File

@ -8,6 +8,8 @@ from areas.models import Areas
from tasks.models import Tasks
from PIL import Image
from django.utils.translation import gettext as _
from captcha.fields import CaptchaField
# Standard-User-Formular - NUR Username und Password wird hier genutzt
class UsersAddNewUser(UserCreationForm):
@ -174,14 +176,22 @@ class SupportForm(forms.Form):
#self.fields["attachment_3"] = forms.FileField(label="Anhang 3", required=False)
class NewAgencyForm(forms.Form):
captcha = CaptchaField()
fields = ['first_name','last_name','mail','agencyname','vve','agb','av','captcha']
field_order = ['first_name','last_name','mail','agencyname','vve','agb','av','captcha']
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields['first_name'] = forms.CharField(required=True, label="Vorname")
self.fields['last_name'] = forms.CharField(required=True, label="Nachname")
self.fields['mail'] = forms.EmailField(required=True, label="E-Mail")
self.fields['agencyname'] = forms.CharField(required=True, label="Agenturname")
self.fields['vve'] = forms.CharField(required=False, label="VVE-Mitgliedsnummer")
self.fields['vve'] = forms.CharField(required=True, label="VVE-Mitgliedsnummer")
self.fields['agb'] = forms.BooleanField(required=True, label="AGB's")
self.fields['av'] = forms.BooleanField(required=True, label="Auftragsverarbeitung")
self.fields['captcha'] = CaptchaField(required=True, label="Bitte geben Sie die Symbole ein.")