Redirect users away from /login, if they are already logged in #3965

Closed
opened 2025-12-29 18:32:20 +01:00 by adam · 2 comments
Owner

Originally created by @n0emis on GitHub (Aug 10, 2020).

Originally assigned to: @n0emis on GitHub.

Environment

  • Python version: 3.8.5
  • NetBox version: 2.8.9

Proposed Functionality

When a already logged-in user access the /login url, they should be redirected to home or to the page from the parameter next.

I created a simple PoC: 061549b0f0

Use Case

This would be especially usefull when using a Remote-Auth-Backend like django.contrib.auth.middleware.PersistentRemoteUserMiddleware, where the HTTP-Header only get's send when accessing the login-page.

Database Changes

No database-changes required

External Dependencies

No new external Dependencies required

Originally created by @n0emis on GitHub (Aug 10, 2020). Originally assigned to: @n0emis on GitHub. <!-- NOTE: IF YOUR ISSUE DOES NOT FOLLOW THIS TEMPLATE, IT WILL BE CLOSED. This form is only for proposing specific new features or enhancements. If you have a general idea or question, please post to our mailing list instead of opening an issue: https://groups.google.com/forum/#!forum/netbox-discuss NOTE: Due to an excessive backlog of feature requests, we are not currently accepting any proposals which significantly extend NetBox's feature scope. Please describe the environment in which you are running NetBox. Be sure that you are running an unmodified instance of the latest stable release before submitting a bug report. --> ### Environment * Python version: 3.8.5 <!-- Example: 3.6.9 --> * NetBox version: 2.8.9 <!-- Example: 2.7.3 --> <!-- Describe in detail the new functionality you are proposing. Include any specific changes to work flows, data models, or the user interface. --> ### Proposed Functionality When a already logged-in user access the `/login` url, they should be redirected to home or to the page from the parameter `next`. I created a simple PoC: https://github.com/n0emis/netbox/commit/061549b0f0b82d8defaad0fbc2fb21ff9765d6a4 <!-- Convey an example use case for your proposed feature. Write from the perspective of a NetBox user who would benefit from the proposed functionality and describe how. ---> ### Use Case This would be especially usefull when using a Remote-Auth-Backend like [`django.contrib.auth.middleware.PersistentRemoteUserMiddleware`](https://docs.djangoproject.com/en/3.0/ref/middleware/#django.contrib.auth.middleware.PersistentRemoteUserMiddleware), where the HTTP-Header only get's send when accessing the login-page. <!-- Note any changes to the database schema necessary to support the new feature. For example, does the proposal require adding a new model or field? (Not all new features require database changes.) ---> ### Database Changes No database-changes required <!-- List any new dependencies on external libraries or services that this new feature would introduce. For example, does the proposal require the installation of a new Python package? (Not all new features introduce new dependencies.) --> ### External Dependencies No new external Dependencies required
adam added the status: acceptedtype: feature labels 2025-12-29 18:32:20 +01:00
adam closed this issue 2025-12-29 18:32:20 +01:00
Author
Owner

@n0emis commented on GitHub (Aug 21, 2020):

@DanSheps Is this accepted so I can work on a PR?

@n0emis commented on GitHub (Aug 21, 2020): @DanSheps Is this accepted so I can work on a PR?
Author
Owner

@jeremystretch commented on GitHub (Aug 21, 2020):

@n0emis Yes, I'll assign this to you.

@jeremystretch commented on GitHub (Aug 21, 2020): @n0emis Yes, I'll assign this to you.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3965