Example #1
0
 def _cleanup_token(self, auth_token):
     for other_token in auth_token.user.auth_token_set.all():
         if other_token.digest != auth_token.digest and other_token.expires:
             if other_token.expires < timezone.now():
                 other_token.delete()
                 username = other_token.user.get_username()
                 token_expired.send(sender=self.__class__,
                                    username=username, source="other_token")
     if auth_token.expires is not None:
         if auth_token.expires < timezone.now():
             username = auth_token.user.get_username()
             auth_token.delete()
             token_expired.send(sender=self.__class__,
                                username=username, source="auth_token")
             return True
     return False
Example #2
0
 def _cleanup_token(self, auth_token):
     for other_token in auth_token.user.auth_token_set.all():
         if other_token.digest != auth_token.digest and other_token.expires is not None:
             if other_token.expires < timezone.now():
                 other_token.delete()
                 username = other_token.user.get_username()
                 token_expired.send(sender=self.__class__,
                                    username=username,
                                    source="other_token")
     if auth_token.expires is not None:
         if auth_token.expires < timezone.now():
             username = auth_token.user.get_username()
             auth_token.delete()
             token_expired.send(sender=self.__class__,
                                username=username,
                                source="auth_token")
             return True
     return False
Example #3
0
 def _cleanup_token(self, auth_token):
     for other_token in auth_token.user.auth_token_set.all():
         if other_token.digest != auth_token.digest and other_token.expiry:
             if other_token.expiry < timezone.now():
                 other_token.delete()
                 phone_number = other_token.user.get_phone_number()
                 token_expired.send(sender=self.__class__,
                                    phone_number=phone_number,
                                    source="other_token")
     if auth_token.expiry is not None:
         if auth_token.expiry < timezone.now():
             phone_number = auth_token.user.get_phone_number()
             auth_token.delete()
             token_expired.send(sender=self.__class__,
                                phone_number=phone_number,
                                source="auth_token")
             return True
     return False