Skip to content

Cannot change superuser email when using custom flag field and createsuperuser #144

@Neraste

Description

@Neraste

Describe the bug

I changed the default flag field with USER_VERIFICATION_FLAG_FIELD and created a superuser with the Django command createsuperuser. 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

  1. Create a Boolean field in user model and set USER_VERIFICATION_FLAG_FIELD to this field;
  2. Create a superuser with Django admin command createsuperuser;
  3. Register a new mail for this superuser;
  4. Validate the new email.

Possible explanation

This is due to the fact createsuperuser will not enable the custom flag field (as it sets username, email and password 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 argument require_verified True by default.

Associated PR

See #145.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions