mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-11-22 07:53:19 +01:00
Never return None from views.public.create_ticket
Would create a 500 when user omitted their email. Only a partial improve. Added a TODO: as this view still breaks if passing non-numeric characters to the ID. I assume this needs a full overhaul really.
This commit is contained in:
parent
c8935eeb63
commit
b7a97183cb
@ -75,6 +75,7 @@ def homepage(request):
|
||||
|
||||
|
||||
def view_ticket(request):
|
||||
# TODO: Use a form here, not enough validation on these parameters.
|
||||
ticket_req = request.GET.get('ticket', '')
|
||||
email = request.GET.get('email', '')
|
||||
|
||||
@ -84,13 +85,6 @@ def view_ticket(request):
|
||||
ticket = Ticket.objects.get(id=ticket_id, submitter_email__iexact=email)
|
||||
except ObjectDoesNotExist:
|
||||
error_message = _('Invalid ticket ID or e-mail address. Please try again.')
|
||||
|
||||
return render(request, 'helpdesk/public_view_form.html', {
|
||||
'ticket': False,
|
||||
'email': email,
|
||||
'error_message': error_message,
|
||||
'helpdesk_settings': helpdesk_settings,
|
||||
})
|
||||
else:
|
||||
if request.user.is_staff:
|
||||
redirect_url = reverse('helpdesk:view', args=[ticket_id])
|
||||
@ -124,6 +118,15 @@ def view_ticket(request):
|
||||
'helpdesk_settings': helpdesk_settings,
|
||||
'next': redirect_url,
|
||||
})
|
||||
else:
|
||||
error_message = _('Missing ticket ID or e-mail address. Please try again.')
|
||||
|
||||
return render(request, 'helpdesk/public_view_form.html', {
|
||||
'ticket': False,
|
||||
'email': email,
|
||||
'error_message': error_message,
|
||||
'helpdesk_settings': helpdesk_settings,
|
||||
})
|
||||
|
||||
|
||||
def change_language(request):
|
||||
|
Loading…
Reference in New Issue
Block a user