dddp/accounts/ddp.py
def validated_user(cls, token, purpose, minutes_valid):
        """Resolve and validate auth token, returns user object."""
        try:
            username, auth_hash = loads(token.decode('base64'))
        except (ValueError, Error):
            cls.auth_failed(token=token)
        try:
            user = cls.user_model.objects.get(**{
                cls.user_model.USERNAME_FIELD: username,
                'is_active': True,
            })
            user.backend = 'django.contrib.auth.backends.ModelBackend'
        except cls.user_model.DoesNotExist:
            cls.auth_failed(username=username, token=token)
        if auth_hash not in iter_auth_hashes(user, purpose, minutes_valid):
            cls.auth_failed(username=username, token=token)
        return user
def validated_user(cls, token, purpose, minutes_valid):
        """Resolve and validate auth token, returns user object."""
        try:
            username, auth_hash = loads(token.decode('base64'))
        except (ValueError, Error):
            cls.auth_failed(token=token)
        try:
            user = cls.user_model.objects.get(**{
                cls.user_model.USERNAME_FIELD: username,
                'is_active': True,
            })
            user.backend = 'django.contrib.auth.backends.ModelBackend'
        except cls.user_model.DoesNotExist:
            cls.auth_failed(username=username, token=token)
        if auth_hash not in iter_auth_hashes(user, purpose, minutes_valid):
            cls.auth_failed(username=username, token=token)
        return user
Resolve and validate auth token, returns user object.