'User' object has no attribute 'ldap_username' error when attempting to change local password #3061

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

Originally created by @hSaria on GitHub (Dec 10, 2019).

Originally assigned to: @hSaria on GitHub.

Environment

  • Python version: 3.6.8
  • NetBox version: 2.6.8

When attempting to browse to the password-change page of a local user, an exception is thrown. Continuation on #3747.

Steps to Reproduce

  1. Create local user
  2. Login with user
  3. Navigate to /user/password/

Expected Behavior

Page loads and allows me to enter the details of the new password

Observed Behavior

Below exception is thrown

There was a problem with your request. Please contact an administrator.

The complete exception is provided below:

<class 'AttributeError'>

'User' object has no attribute 'ldap_username'
If further assistance is required, please post to the NetBox mailing list.
Originally created by @hSaria on GitHub (Dec 10, 2019). Originally assigned to: @hSaria on GitHub. ### Environment * Python version: 3.6.8 * NetBox version: 2.6.8 When attempting to browse to the password-change page of a local user, an exception is thrown. Continuation on #3747. ### Steps to Reproduce 1. Create local user 2. Login with user 3. Navigate to `/user/password/` ### Expected Behavior Page loads and allows me to enter the details of the new password ### Observed Behavior Below exception is thrown ``` There was a problem with your request. Please contact an administrator. The complete exception is provided below: <class 'AttributeError'> 'User' object has no attribute 'ldap_username' If further assistance is required, please post to the NetBox mailing list. ```
adam added the type: bugstatus: accepted labels 2025-12-29 18:25:16 +01:00
adam closed this issue 2025-12-29 18:25:16 +01:00
Author
Owner

@hSaria commented on GitHub (Dec 10, 2019):

This is a bug introduced in b1761f7856 (diff-73376e8b4737afa086136adcf5270ae6R99).

Just gotta replace in netbox/users/views.py

- if getattr(request.user, 'ldap_username'):
+ if getattr(request.user, 'ldap_username', None):
@hSaria commented on GitHub (Dec 10, 2019): This is a bug introduced in https://github.com/netbox-community/netbox/commit/b1761f78567bc5137771128557d851f37efa385b#diff-73376e8b4737afa086136adcf5270ae6R99. Just gotta replace in `netbox/users/views.py` ```python - if getattr(request.user, 'ldap_username'): + if getattr(request.user, 'ldap_username', None): ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3061