Fixed #204 -- Changed 'django-admin createsuperuser' to disallow blank passwords

git-svn-id: http://code.djangoproject.com/svn/django/trunk@314 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2005-07-26 14:37:00 +00:00
parent 1484f2e225
commit e207378ad3
1 changed files with 7 additions and 3 deletions

View File

@ -401,9 +401,13 @@ def createsuperuser():
while 1: while 1:
password = getpass.getpass() password = getpass.getpass()
password2 = getpass.getpass('Password (again): ') password2 = getpass.getpass('Password (again): ')
if password == password2: if password != password2:
break sys.stderr.write("Error: Your passwords didn't match.\n")
sys.stderr.write("Error: Your passwords didn't match.\n") continue
if password.strip() == '':
sys.stderr.write("Error: Blank passwords aren't allowed.\n")
continue
break
except KeyboardInterrupt: except KeyboardInterrupt:
sys.stderr.write("\nOperation cancelled.\n") sys.stderr.write("\nOperation cancelled.\n")
sys.exit(1) sys.exit(1)