def test_process_ax_data(self): """ Tests integration of OpenID AX data with the current user's profile. """ new_user = User(username = utils.generate_random_user_name()) new_user.save() user_profile = UserProfile.objects.get_user_profile(new_user) utils.process_ax_data(new_user, self.openid.ax) user_profile = UserProfile.objects.get_user_profile(new_user) self.assertEqual(new_user.profile.display_name, 'hanbox') self.assertEqual(new_user.email, '*****@*****.**') new_user.delete()
def process_request(self, request): if not request.user.is_authenticated(): if request.openid: try: user_open_id = UserOpenID.objects.get(openid = request.openid.openid) request.user = user_open_id.user except ObjectDoesNotExist: request.user = create_user_from_openid(request, request.openid) if not request.user.is_authenticated() and ANONYMOUS_USERS_ENABLED: request.user = get_anon_user(request) if request.user.is_authenticated(): request.user.profile = UserProfile.objects.get_user_profile(request.user) request.user.last_login = datetime.datetime.now() request.user.save() if getattr(request.openid, 'ax', None) and request.user.is_authenticated(): process_ax_data(request.user, request.openid.ax.data)
def process_request(self, request): if not request.user.is_authenticated(): if request.openid: try: user_open_id = UserOpenID.objects.get( openid=request.openid.openid) request.user = user_open_id.user except ObjectDoesNotExist: request.user = create_user_from_openid( request, request.openid) if not request.user.is_authenticated() and ANONYMOUS_USERS_ENABLED: request.user = get_anon_user(request) if request.user.is_authenticated(): request.user.profile = UserProfile.objects.get_user_profile( request.user) request.user.last_login = datetime.datetime.now() request.user.save() if getattr(request.openid, 'ax', None) and request.user.is_authenticated(): process_ax_data(request.user, request.openid.ax.data)