Commit 42ff5a38 authored by ibuler's avatar ibuler

[Update] 修改设置session的时间,避免sdk等报错

parent 0ee5d3b7
......@@ -57,7 +57,8 @@ class RequestMiddleware:
def __call__(self, request):
set_current_request(request)
response = self.get_response(request)
if not settings.SESSION_EXPIRE_AT_BROWSER_CLOSE:
is_request_api = request.path.startswith('/api')
if not settings.SESSION_EXPIRE_AT_BROWSER_CLOSE and not is_request_api:
age = request.session.get_expiry_age()
request.session.set_expiry(age)
return response
......@@ -179,6 +179,11 @@ class UserProfileApi(generics.RetrieveAPIView):
def get_object(self):
return self.request.user
def retrieve(self, request, *args, **kwargs):
age = request.session.get_expiry_age()
request.session.set_expiry(age)
return super().retrieve(request, *args, **kwargs)
class UserResetOTPApi(generics.RetrieveAPIView):
queryset = User.objects.all()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment