-
Notifications
You must be signed in to change notification settings - Fork 84
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
Cannot change superuser email when using custom flag field and createsuperuser #144
Comments
Hi @Neraste , I'm still unsure if that's an actual bug; I'm trying to understand your use case. Does that mean that you want your users to be able to log in when they are still unverified? and after they log in, they could theoretically change their email to another one? that use case may not work as expected, as using different field from The current assumption was to use only verified user data (with some exceptions, like reset password) to avoid security issues. But it looks that we could loosen up that requirement, as |
I could see from the tests that using a different field than
This also means that a using the I think using A superuser created with the Using a custom field, the superuser has not their email address validated by default. Their ability to log in depends on the authentication backend, but they cannot change their email with this library, which sounds unexpected and is the reason of this issue. On the other hand, using |
I know this is a very edgy case, as you don't create tons of superusers from the command line. On my side, I considered a superuser without a valid email would be acceptable in my authentication backend, so I was surprised that my superuser couldn't change their email. I imagined that they could pass trough the email check, as implemented in the PR. Eventually, I solved the problem in my project by forbidding users with un-validated email address to change their email address on the front (only such superusers should fall in this case). |
Describe the bug
I changed the default flag field with
USER_VERIFICATION_FLAG_FIELD
and created a superuser with the Django commandcreatesuperuser
. Changing this superuser's email results in an error when verifying the email.Expected behavior
Superuser email is changed.
Actual behavior
Error 400 with the error message: "User not found."
Steps to reproduce
USER_VERIFICATION_FLAG_FIELD
to this field;createsuperuser
;Possible explanation
This is due to the fact
createsuperuser
will not enable the custom flag field (as it setsusername
,email
andpassword
by default), hence this superuser is not considered as valid and cannot be retrieved.In
rest_registration.api.views.register_email.process_verify_email_data
,get_user_by_verification_id
is called with argumentrequire_verified
True by default.Associated PR
See #145.
The text was updated successfully, but these errors were encountered: