bennylope / django-organizations

:couple: Multi-user accounts for Django projects
http://django-organizations.readthedocs.org/
BSD 2-Clause "Simplified" License
1.31k stars 212 forks source link

_num_days attribute does not exist on RegistrationTokenGenerator #206

Closed leon-tnvm closed 3 years ago

leon-tnvm commented 4 years ago

When calling check_token() on RegistrationTokenGenerator, an error is thrown because the function uses _num_days which does not exist on RegistrationTokeneGenerator or the base class PasswordResetTokenGenerator.

This is it, line 67-69 of organizations/backends/token.py:

        # Check the timestamp is within limit
        if (self._num_days(self._today()) - ts) > REGISTRATION_TIMEOUT_DAYS:
            return False

Perhaps num_days was deprecated and this not updated?

This is on Python3.8 running django3.1 and django-organizations-1.1.2

bennylope commented 3 years ago

The custom token generator was removed in 57277d287eb92c5d2abb7daf5dcbffbde91ceb6f. If someone provides a patch I could make a bug fix for the 1.x version, otherwise I'd recommend extending the backend class to override the token generator.