Commit a6293440 authored by Daniel Gal's avatar Daniel Gal
Browse files

Fixed broken auth flow on page unload

parent 4bc4787e
Pipeline #4021 passed with stage
in 4 minutes and 24 seconds
......@@ -4,6 +4,7 @@ from rest_framework import permissions
from rest_framework.decorators import action
from rest_framework.response import Response
from django.shortcuts import redirect
from django.contrib.auth import logout
from rest_framework.decorators import api_view
from common.mixins import RelativeURLFieldMixin
......@@ -19,6 +20,11 @@ def set_display_name(request):
if len(request.session.values()) == 0:
return Response(status=401)
# Interrupt auth flow from browser
if "cancel" in request.data:
logout(request)
return Response(status=204)
serializer = serializers.DisplayNameSerializer(data=request.data)
serializer.is_valid(raise_exception=True)
......
Supports Markdown
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