Opened 5 hours ago
Closed 110 minutes ago
#35929 closed Uncategorized (invalid)
Unable to login using superuser account with 5.1.3 default install
Reported by: | R Murthy | Owned by: | |
---|---|---|---|
Component: | Uncategorized | Version: | 5.1 |
Severity: | Normal | Keywords: | |
Cc: | R Murthy | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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)
Running Environment:
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
Commands run on the shell:
>>> 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.
Please see TicketClosingReasons/UseSupportChannels for ways to get help. This ticket tracker is only for reporting confirmed bugs.