Ticket #5761: password.diff

File password.diff, 868 bytes (added by Nir Soffer <nirs@…>, 8 years ago)

patch

  • django/contrib/auth/models.py

    diff -ur Django-0.96/django/contrib/auth/models.py Django-0.96-new/django/contrib/auth/models.py
    old new  
    7979        "Generates a random password with the given length and given allowed_chars"
    8080        # Note that default value of allowed_chars does not have "I" or letters
    8181        # that look like it -- just to avoid confusion.
    82         from random import choice
    83         return ''.join([choice(allowed_chars) for i in range(length)])
     82        import random
     83        return ''.join(random.sample(allowed_chars, length))
    8484
    8585class User(models.Model):
    8686    """Users within the Django authentication system are represented by this model.
Back to Top