Skip to content

Check for UserConfig instance during user login #9741

@jeremystretch

Description

@jeremystretch

Proposed Changes

Check for the presence of a UserConfig instance after calling auth_login(). If a UserConfig instance does not exist for the user, create one.

Justification

When a new NetBox user is created, a UserConfig instance gets created automatically by the create_userconfig() receiver of the post_save signal. However, as discussed in #8718 (specifically this thread) there may be some scenarios where the automatic creation of a UserConfig does not occur for some unknown factor. (The example in question concerns a Docker deployment, but the condition could potentially arise in other cases, such as after an inadvertent deletion.)

Although it should not be strictly necessary, adding a sanity check to the login process should avoid an RelatedObjectDoesNotExist exception in such a scenario, and allow the user to log in and use NetBox successfully.

Metadata

Metadata

Assignees

Labels

status: acceptedThis issue has been accepted for implementationtype: housekeepingChanges to the application which do not directly impact the end user

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions