macropin/django-registration

ACCOUNT_ACTIVATION_DAYS not an int

AntonOfTheWoods opened this issue · 1 comments

I am getting ACCOUNT_ACTIVATION_DAYS from an envvar via getenv and forgot to cast as an int before assignment. That left me with a very cryptic error message - '>' not supported between instances of 'float' and 'str' - in django/core/signing.py. signing.loads requires an int (or at least a number) and * int in python on a string will repeat that string int times rather than complain... Leading to the error. The relevant code in django-registration is:

            username = signing.loads(
                activation_key,
                salt=REGISTRATION_SALT,
                max_age=settings.ACCOUNT_ACTIVATION_DAYS * 86400,
            )

Simply wrapping an int around settings.ACCOUNT_ACTIVATION_DAYS would make for a super-easy "fix", in the sense that it's documented and int is pretty sensible (IMHO). Would you be interested in a PR? What would that PR need to look like? (I won't have time for lots of tests for a few weeks).

Man it's annoying that this repo is the one that always comes up in Google...