#35929: Unable to login using superuser account with 5.1.3 default install
--------------------------+-----------------------------------------
Reporter: R Murthy | Type: Uncategorized
Status: new | Component: Uncategorized
Version: 5.1 | Severity: Normal
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------+-----------------------------------------
I have created new python virtual environment to work on django version
5.1.3. Created a new superuser called admin. Run the server. Open the
browser to
http://127.0.0.1:8000/admin. Login with the user, admin and
password input at the creation time. It throws an error, "Please enter the
correct username and password for a staff account. Note that both fields
may be case-sensitive."
Start the shell to verify the superuser settings, it shows the admin user
has staff, superuser, and active set.
Use the shell to create another superuser, test. Set the staff, superuser,
and active flags. On the browser, login using the new superuser account,
test. It logs you in. Reset the 'admin' superuser by unchecking the staff,
superuser, and active boxes. Save. Check the boxes. Save. Log out of
'test' superuser account. Login using 'admin' superuser account. Success.
I suspect there is an issue with the createsuperuser script. Can you
please let me know?
Also, I could not find any documentation on viewing account details using
the shell. It is possible I may have missed it when I ran a search on the
documentation. If it is there and I missed it, my apologies.
Environment: Windows 11 Pro, Python 3.1.3, django 5.1.3, Microsoft Edge
Browser Version 131.0.2903.51 (Official build) (64-bit)
{{{#!div style="font-size: 80%"
Running Environment:
{{{#!powershell
py --version
Python 3.13.0
py -m pip list
Package Version
------------ -------
asgiref 3.8.1
distlib 0.3.9
Django 5.1.3
filelock 3.16.1
pip 24.3.1
platformdirs 4.3.6
sqlparse 0.5.2
tzdata 2024.2
virtualenv 20.27.1
}}}
}}}
{{{#!div style="font-size: 80%"
Commands run on the shell:
{{{#!python
>>> from django.contrib.auth.models import User
>>> usr=User.objects.get(username='admin')
>>> usr.is_staff
True
>>> usr.is_superuser
True
>>> usr.is_active
True
>>> usr=User.objects.create_user('test', 'test@localhost', 'test123')
>>> usr.save()
>>> usr.is_superuser
False
>>> usr.is_superuser=True
>>> usr.is_active
True
>>> usr.is_staff
False
>>> usr.is_staff=True
>>> usr.save()
>>> ^Z
now exiting InteractiveConsole...
}}}
}}}
Please note that other than running the migrate and createsuperuser
commands to enable superuser account, there are no changes made to the
default install.
If I have missed any other relevant information, kindly contact me.
Thanks for looking into this issue.
--
Ticket URL: <
https://code.djangoproject.com/ticket/35929>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.