diff --git a/helpdesk/templates/helpdesk/public_view_ticket.html b/helpdesk/templates/helpdesk/public_view_ticket.html index c3ebcce5..84c31617 100644 --- a/helpdesk/templates/helpdesk/public_view_ticket.html +++ b/helpdesk/templates/helpdesk/public_view_ticket.html @@ -74,4 +74,79 @@ {% endfor %} {% endif %} +
+ + {% endblock %} diff --git a/helpdesk/views/public.py b/helpdesk/views/public.py index 1e94cd82..94960e58 100644 --- a/helpdesk/views/public.py +++ b/helpdesk/views/public.py @@ -181,6 +181,8 @@ def view_ticket(request): redirect_url = reverse('helpdesk:view', args=[ticket_id]) return render(request, 'helpdesk/public_view_ticket.html', { + 'key': key, + 'mail': email, 'ticket': ticket, 'helpdesk_settings': helpdesk_settings, 'next': redirect_url, diff --git a/helpdesk/views/staff.py b/helpdesk/views/staff.py index e8afc01e..0534c84b 100644 --- a/helpdesk/views/staff.py +++ b/helpdesk/views/staff.py @@ -451,15 +451,32 @@ def subscribe_staff_member_to_ticket(ticket, user, email=''): def update_ticket(request, ticket_id, public=False): + + ticket = None + if not (public or ( request.user.is_authenticated and request.user.is_active and ( is_helpdesk_staff(request.user) or helpdesk_settings.HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE))): - return HttpResponseRedirect('%s?next=%s' % - (reverse('helpdesk:login'), request.path)) - ticket = get_object_or_404(Ticket, id=ticket_id) + key = request.POST.get('key') + email = request.POST.get('mail') + + if key and email: + ticket = Ticket.objects.get( + id=ticket_id, + submitter_email__iexact=email, + secret_key__iexact=key + ) + + if not ticket: + return HttpResponseRedirect( + '%s?next=%s' % (reverse('helpdesk:login'), request.path) + ) + + if not ticket: + ticket = get_object_or_404(Ticket, id=ticket_id) date_re = re.compile( r'(?P