perf: 修改 ticket 认证的

pull/11552/head
ibuler 2023-09-13 17:19:13 +08:00
parent d0f79c2df2
commit bcda879f3b
1 changed files with 4 additions and 0 deletions

View File

@ -4,6 +4,7 @@
from __future__ import unicode_literals
from django.core.cache import cache
from django.http import HttpResponse
from django.shortcuts import redirect, reverse
from django.utils.translation import gettext as _
from django.views.generic.base import TemplateView
@ -79,6 +80,9 @@ class TicketDirectApproveView(TemplateView):
return super().get_context_data(**kwargs)
def get(self, request, *args, **kwargs):
if not request.user.is_authenticated:
return HttpResponse(status=401)
token = kwargs.get('token')
ticket_info = cache.get(token)
if not ticket_info: