﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
15639	make_random_password in django.contrib.auth.models   UserManager(models.Manager):	anonymous	nobody	"make_random_password in django.contrib.auth.models   UserManager(models.Manager):

appears to use 'choice' from the python random module.

{{{
    def make_random_password(self, length=10, allowed_chars='abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'):
        ""Generates a random password with the given length and given allowed_chars""
        # Note that default value of allowed_chars does not have ""I"" or letters
        # that look like it -- just to avoid confusion.
        from random import choice
        return ''.join([choice(allowed_chars) for i in range(length)])

}}}

I propose the following instead:

{{{
    def make_random_password(self, length=10, allowed_chars='abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'):
        ""Generates a random password with the given length and given allowed_chars""
        # Note that default value of allowed_chars does not have ""I"" or letters
        # that look like it -- just to avoid confusion.
        from random import SystemRandom as random
        return ''.join([random().choice(allowed_chars) for i in range(length)])

}}}




"		closed	Uncategorized	1.2		needsinfo			Unreviewed	0	0	0	0	0	0
