1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fix #3228 - UrlEncode full path for next if not on logon page

Include the full path for the ?next= variable in login links if we are not on the logon page.
Additionally include next for post requests that have the next variable set (will only come from the login page itself generally)
This commit is contained in:
dansheps
2019-05-30 12:01:41 -05:00
parent 1958c0b118
commit 814c50f461
2 changed files with 7 additions and 1 deletions

View File

@ -413,7 +413,12 @@
</ul>
</li>
{% else %}
<li><a href="{% url 'login' %}?next={{ request.path }}"><i class="fa fa-sign-in"></i> Log in</a></li>
{% url 'login' as login_url %}
{% if request.path == login_url %}
<li><a href="{{ request.get_full_path }}"><i class="fa fa-sign-in"></i> Log in</a></li>
{% else %}
<li><a href="{{ login_url }}?next={{ request.get_full_path | urlencode }}"><i class="fa fa-sign-in"></i> Log in</a></li>
{% endif %}
{% endif %}
</ul>
<form action="{% url 'search' %}" method="get" class="navbar-form navbar-right" id="navbar_search" role="search">

View File

@ -25,6 +25,7 @@
<div class="panel-body">
{% csrf_token %}
{% if 'next' in request.GET %}<input type="hidden" name="next" value="{{ request.GET.next }}" />{% endif %}
{% if 'next' in request.POST %}<input type="hidden" name="next" value="{{ request.POST.next }}" />{% endif %}
{% render_form form %}
</div>
<div class="panel-footer text-right">