fizista / django-password-validators

Additional libraries for validating passwords in Django.
BSD 3-Clause "New" or "Revised" License
51 stars 30 forks source link

PasswordHistory.password CharField max_length should be 255, not 256, for db compability sake (Mainly MySQL) #1

Closed ciarancourtney closed 6 years ago

ciarancourtney commented 7 years ago

https://github.com/fizista/django-password-validators/blob/master/django_password_validators/password_history/models.py#L74

I got an error when using a default MySQL56 db from RDS that I couldn't recreate on a local MySQL install, most likley due to UTF8 collation type:

django.db.utils.OperationalError: (1071, 'Specified key was too long; max key length is 767 bytes')

Looking online it seems the general consensis is to use max_length=255 for CharFields:

https://docs.djangoproject.com/en/1.11/ref/databases/#character-fields https://stackoverflow.com/questions/1814532/1071-specified-key-was-too-long-max-key-length-is-767-bytes

fizista commented 6 years ago

You're right. Corrected in the new version.