Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix createsuperuser/changepassword #16

Merged
merged 1 commit into from
Aug 3, 2020
Merged

Conversation

edarchis
Copy link
Member

The issue comes from the User, InteractiveUser and TechnicalUser all inheriting from the base AbstractUser and having a _u delegation. This means that Django cannot guess from User that it has to request a password when using createsuperuser. So we're allowing an empty password by default.
This obviously requires to set the password in a second command. The changepassword was not working either because when setting the password, it was properly delegated to the underlying TechnicalUser but that user was not saved, only User. I therefore added a save() function to delegate the saving of the underlying object if it had already been created (it has an id).

I am a bit afraid of side effects with the auto provisioning of users and other use cases.

The issue comes from the User, InteractiveUser and TechnicalUser all inheriting from the base AbstractUser and having a _u delegation. This means that Django cannot guess from User that it has to request a password when using createsuperuser. So we're allowing an empty password by default.
This obviously requires to set the password in a second command. The changepassword was not working either because when setting the password, it was properly delegated to the underlying TechnicalUser but that user was not saved, only User. I therefore added a save() function to delegate the saving of the underlying object if it had already been created (it has an id).
@edarchis edarchis requested a review from xgill July 23, 2020 14:20
@xgill xgill merged commit be2f07a into develop Aug 3, 2020
@xgill xgill deleted the bugfix/create_super_user branch August 3, 2020 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants