mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 10:02:46 +00:00
feat: chat captcha (#3279)
This commit is contained in:
parent
9ab90a7b21
commit
a93d7ca6d7
|
|
@ -10,5 +10,6 @@ urlpatterns = [
|
|||
path('profile', views.AuthProfile.as_view()),
|
||||
path('application/profile', views.ApplicationProfile.as_view()),
|
||||
path('chat_message/<str:chat_id>', views.ChatView.as_view()),
|
||||
path('open', views.OpenView.as_view())
|
||||
path('open', views.OpenView.as_view()),
|
||||
path('captcha', views.CaptchaView.as_view(), name='captcha'),
|
||||
]
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ from common.auth import TokenAuth
|
|||
from common.constants.permission_constants import ChatAuth
|
||||
from common.exception.app_exception import AppAuthenticationFailed
|
||||
from common.result import result
|
||||
from users.api import CaptchaAPI
|
||||
from users.serializers.login import CaptchaSerializer
|
||||
|
||||
|
||||
class AnonymousAuthentication(APIView):
|
||||
|
|
@ -122,3 +124,14 @@ class OpenView(APIView):
|
|||
data={'application_id': request.auth.application_id,
|
||||
'chat_user_id': request.auth.chat_user_id, 'chat_user_type': request.auth.chat_user_type,
|
||||
'debug': False}).open())
|
||||
|
||||
|
||||
class CaptchaView(APIView):
|
||||
@extend_schema(methods=['GET'],
|
||||
summary=_("Get captcha"),
|
||||
description=_("Get captcha"),
|
||||
operation_id=_("Get captcha"), # type: ignore
|
||||
tags=[_("User Management")], # type: ignore
|
||||
responses=CaptchaAPI.get_response())
|
||||
def get(self, request: Request):
|
||||
return result.success(CaptchaSerializer().generate())
|
||||
|
|
|
|||
Loading…
Reference in New Issue