request to fill all variables

This commit is contained in:
Martin Quarda 2024-02-28 15:49:51 +01:00
parent 8b234afe39
commit be7cd33881
2 changed files with 7 additions and 1 deletions

View File

@ -12,6 +12,12 @@ def register(request):
return HttpResponse('{"reason":"Too late!"}', status=400, content_type='application/json')
if not request.POST.get('agreement'):
return HttpResponse('{"reason":"Je potřeba souhlasit se zpracováním údajů!"}', status=400, content_type='application/json')
if not request.POST['first_name']:
return HttpResponse('{"reason":"Jméno je povinné!"}', status=400, content_type='application/json')
if not request.POST['last_name']:
return HttpResponse('{"reason":"Přijmení je povinné!"}', status=400, content_type='application/json')
if not request.POST['email']:
return HttpResponse('{"reason":"Email je povinný!"}', status=400, content_type='application/json')
if User.objects.filter(email=request.POST['email']):
return HttpResponse('{"reason":"Email je již registrován!"}', status=400, content_type='application/json')
try:

View File

@ -91,7 +91,7 @@ class Main extends Component {
</div>
<div class="mb-3">
<label for="date_of_birth" class="form-label">Datum narození</label>
<input type="date" class="form-control" id="date_of_birth" name="date_of_birth" />
<input type="date" class="form-control" id="date_of_birth" name="date_of_birth" max={new Date().toJSON().slice(0, 10)} />
</div>
<div class="mb-3 form-check">
<input type="checkbox" class="form-check-input" id="agreement" name="agreement" />