Пример #1
0
 def get_for_openid(self, request, target_openid):
     try:
         user_openid = super(UserOpenIDManager, self).get(openid = target_openid.openid)
         user = user_openid.user
     except ObjectDoesNotExist:
         from django_community.utils import create_user_from_openid
         user = create_user_from_openid(request, target_openid)
     return user
Пример #2
0
 def get_for_openid(self, request, target_openid):
     try:
         user_openid = super(UserOpenIDManager,
                             self).get(openid=target_openid.openid)
         user = user_openid.user
     except ObjectDoesNotExist:
         from django_community.utils import create_user_from_openid
         user = create_user_from_openid(request, target_openid)
     return user
Пример #3
0
 def test_create_from_openid(self):
     """
     Tests creation of a new user from an OpenID.
     """
     user = utils.create_user_from_openid(self.request, self.openid)
     openids = UserOpenID.objects.filter(user = user)
     self.assertTrue(user)
     self.assertTrue(openids)
     self.assertTrue(self.openid.openid in [x.openid for x in openids])
     user.delete()
Пример #4
0
 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)
Пример #5
0
 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)