コード例 #1
0
ファイル: tests.py プロジェクト: jingchan/jh_rogue
 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()
コード例 #2
0
ファイル: middleware.py プロジェクト: genghisu/eruditio
 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)
コード例 #3
0
ファイル: middleware.py プロジェクト: jingchan/jh_rogue
 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)