Social auth user creation with email as name causes ModuleNotFoundError: no module named netbox.users #7185

Closed
opened 2025-12-29 20:20:16 +01:00 by adam · 1 comment
Owner

Originally created by @xTrekStorex on GitHub (Nov 1, 2022).

NetBox version

v3.3.6

Python version

3.9

Steps to Reproduce

Using python social auth with Azure AD and setting SOCIAL_AUTH_USERNAME_IS_FULL_EMAIL = True.
Login with non-existing user.

Expected Behavior

Non-existing user is created with email as username.

Observed Behavior

ModuleNotFoundError: no module named netbox.users

Existing users with linked user-social-auth can login.
Existing users still use name attribute for username (default social auth behavior).

When changing the SOCIAL_AUTH_CLEAN_USERNAME_FUNCTION setting from 'netbox.users.utils.clean_username' to 'users.utils.clean_username' (matching file structure in netbox folder) login / user creation works.

The setting was introduced in cc00789d35

Originally created by @xTrekStorex on GitHub (Nov 1, 2022). ### NetBox version v3.3.6 ### Python version 3.9 ### Steps to Reproduce Using python social auth with Azure AD and setting `SOCIAL_AUTH_USERNAME_IS_FULL_EMAIL = True`. Login with non-existing user. ### Expected Behavior Non-existing user is created with email as username. ### Observed Behavior `ModuleNotFoundError: no module named netbox.users` Existing users with linked user-social-auth can login. Existing users still use name attribute for username (default social auth behavior). When changing the `SOCIAL_AUTH_CLEAN_USERNAME_FUNCTION` setting from `'netbox.users.utils.clean_username'` to `'users.utils.clean_username'` (matching file structure in netbox folder) login / user creation works. The setting was introduced in https://github.com/netbox-community/netbox/commit/cc00789d35a255e05ea80d9cdd138fe547c670ad
adam added the type: bugstatus: duplicate labels 2025-12-29 20:20:16 +01:00
adam closed this issue 2025-12-29 20:20:17 +01:00
Author
Owner

@kkthxbye-code commented on GitHub (Nov 1, 2022):

Duplicate of https://github.com/netbox-community/netbox/issues/10770

@kkthxbye-code commented on GitHub (Nov 1, 2022): Duplicate of https://github.com/netbox-community/netbox/issues/10770
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7185