def _verify(self, assertion=None, email=None): with self.activate("en-US"): request = self.factory.get(reverse("home")) if email: request.session[SESSION_VERIFY] = self._verification(email) return verify(request, assertion)
def _verify(self, assertion=None, email=None): with self.activate('en-US'): request = self.factory.get(reverse('home')) if email: request.session[SESSION_VERIFY] = self._verification(email) return verify(request, assertion)
def authenticate(self, request=None, assertion=None): if request: verification = verify(request, assertion) if not verification: return None try: user = User.objects.get(email=verification['email']) if user.is_active: return user except (User.DoesNotExist, User.MultipleObjectsReturned): pass return None