diff --git a/awx/sso/views.py b/awx/sso/views.py index 82c8ec836a..39163e7c6d 100644 --- a/awx/sso/views.py +++ b/awx/sso/views.py @@ -11,7 +11,8 @@ from django.http import HttpResponse from django.views.generic import View from django.views.generic.base import RedirectView from django.utils.encoding import smart_text -from django.contrib import auth +from awx.api.serializers import UserSerializer +from rest_framework.renderers import JSONRenderer logger = logging.getLogger('awx.sso.views') @@ -39,8 +40,12 @@ class CompleteView(BaseRedirectView): def dispatch(self, request, *args, **kwargs): response = super(CompleteView, self).dispatch(request, *args, **kwargs) if self.request.user and self.request.user.is_authenticated(): - auth.login(self.request, self.request.user) logger.info(smart_text(u"User {} logged in".format(self.request.user.username))) + response.set_cookie('userLoggedIn', 'true') + current_user = UserSerializer(self.request.user) + current_user = JSONRenderer().render(current_user.data) + current_user = urllib.quote('%s' % current_user, '') + response.set_cookie('current_user', current_user) return response