From d78981098412cfeacba94a4100b184d8695aca8f Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Tue, 12 Jul 2022 16:02:41 +0800 Subject: [PATCH] fix: condirm (#8572) Co-authored-by: feng626 <1304903146@qq.com> --- apps/authentication/api/confirm.py | 9 ++++++++- apps/authentication/urls/api_urls.py | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/authentication/api/confirm.py b/apps/authentication/api/confirm.py index c085bb017..d3a32a7c8 100644 --- a/apps/authentication/api/confirm.py +++ b/apps/authentication/api/confirm.py @@ -7,11 +7,18 @@ from rest_framework.generics import RetrieveAPIView, CreateAPIView from rest_framework.response import Response from rest_framework import status -from common.permissions import IsValidUser +from common.permissions import IsValidUser, UserConfirmation from ..const import ConfirmType from ..serializers import ConfirmSerializer +class ConfirmBindORUNBindOAuth(RetrieveAPIView): + permission_classes = (UserConfirmation.require(ConfirmType.ReLogin),) + + def retrieve(self, request, *args, **kwargs): + return Response('ok') + + class ConfirmApi(RetrieveAPIView, CreateAPIView): permission_classes = (IsValidUser,) serializer_class = ConfirmSerializer diff --git a/apps/authentication/urls/api_urls.py b/apps/authentication/urls/api_urls.py index dd1faff28..cfbac879f 100644 --- a/apps/authentication/urls/api_urls.py +++ b/apps/authentication/urls/api_urls.py @@ -27,6 +27,7 @@ urlpatterns = [ path('auth/', api.TokenCreateApi.as_view(), name='user-auth'), path('confirm/', api.ConfirmApi.as_view(), name='user-confirm'), + path('confirm-oauth/', api.ConfirmBindORUNBindOAuth.as_view(), name='confirm-oauth'), path('tokens/', api.TokenCreateApi.as_view(), name='auth-token'), path('mfa/verify/', api.MFAChallengeVerifyApi.as_view(), name='mfa-verify'), path('mfa/challenge/', api.MFAChallengeVerifyApi.as_view(), name='mfa-challenge'),