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

UserConfig is not being created when pre-creating a account for use with social auth #14515

Closed
DanSheps opened this issue Dec 13, 2023 · 1 comment · Fixed by #14524
Closed
Assignees
Labels
severity: medium Results in substantial degraded or broken functionality for specfic workflows status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@DanSheps
Copy link
Member

Deployment Type

Self-hosted

NetBox Version

v3.6.6

Python Version

3.11

Steps to Reproduce

  1. Connect to a social auth system
  2. Pre-create a user account
  3. Login with user account

Expected Behavior

Login succeeds

Observed Behavior

Exception: User.config.RelatedObjectDoesNotExist

@DanSheps DanSheps added type: bug A confirmed report of unexpected behavior in the application status: accepted This issue has been accepted for implementation labels Dec 13, 2023
@DanSheps DanSheps self-assigned this Dec 13, 2023
@DanSheps
Copy link
Member Author

Root cause is:

@receiver(post_save, sender=User)

It was never updated for NetBoxUser model being the primary user model in #12589

A normal login user will hit this codeblock:

if not hasattr(request.user, 'config'):
config = get_config()
UserConfig(user=request.user, data=config.DEFAULT_USER_PREFERENCES).save()

Simply adding @receiver(post_save, sender=NetBoxUser) in addition to the existing receiver resolves this.

@DanSheps DanSheps added the severity: medium Results in substantial degraded or broken functionality for specfic workflows label Dec 13, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
severity: medium Results in substantial degraded or broken functionality for specfic workflows status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant