-
Notifications
You must be signed in to change notification settings - Fork 6
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 ./manage.py createsuperuser
#20
base: main
Are you sure you want to change the base?
Conversation
@@ -40,7 +40,7 @@ def _nonce_is_valid(nonce: str) -> bool: | |||
|
|||
class SiweBackend(BaseBackend): | |||
""" | |||
Authenticate an Ethereum address as per Sing-In with Ethereum (EIP-4361). | |||
Authenticate an Ethereum address as per Sign-In with Ethereum (EIP-4361). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😅
This is because of https://github.com/payton/django-siwe-auth/blob/main/README.md?plain=1#L174
Agreed! I don't think creating a superuser should trigger any authentication workflows. Ideally I can just pass in an ethereum address for createsuperuser.
As far as creating a superuser goes, I think we may need a deeper override if possible. If that's not possible, it may be better to just instruct users to add a user to the DB directly and toggle the superuser column. There's also another issue with admin logins. We want to be able to use SIWE while signing in to the Django admin panel. That's covered in this issue #7 |
I'm going to hold off on landing this one temporarily since we maybe able to find a more concrete alternative! |
Totally reasonable 👍 |
Okay, yeah, this is totally a bad solution. I was using I've discovered that you can override django management commands by have a command of the same name. I have WIP branch here: The main issue is that |
When I run
./manage.py createsuperuser
I get an error:I was able to fix it by adding
password
as an (ignored) parameter toWalletManager.create_superuser
but this feels like a pretty inelegant solution.I'm also not clear how the command
createsuperuser
is modified from Django. (And how did Django know to ask for the Ethereum address field?)Creating a superuser also didn't trigger data fetch from an ethereum data provider, but that's probably fine. :D
Is there a better way to fix this bug? (And is this hacky solution going to fail some future
mypy
type-checking or linting?)